0

I have successfully uploaded the image to the folder and stored the name of the image in the database now I'm trying to retrieve the uploaded image in my table, but I'm unable to retrieve that please can any one help me in this, it would be really helpful for me.

 ///my view page <table width="600" border="1" cellspacing="5" cellpadding="5"> <tr style="background:#CCC"> <th>ID</th> <th>First name</th> <th>Last name</th> <th>Username</th> <th>E-mail</th> <th>Image</th> <th>Update</th> </tr> <?php $i=1; foreach($data as $row) { echo "<tr>"; echo "<td>".$i."</td>"; echo "<td>".$row->first_name."</td>"; echo "<td>".$row->last_name."</td>"; echo "<td>".$row->username."</td>"; echo "<td>".$row->email."</td>"; echo "<td>".<img src="<?php echo base_url('uploads/'.$row->filename);?>" alt="" width="100%" height="100%">."</td>"; echo "<td><a href='updatedata?id=".$row->ID."'>Update</a></td>"; echo "</tr>"; $i++; } ?> </table> 
1
  • whats the html output? whats the content of $data? Commented Jul 10, 2018 at 15:46

2 Answers 2

3

You already start echo, there's no need to echo inside echo:

echo '<td><img src="' . base_url('uploads/' . $row->filename) . '" alt="" width="100%" height="100%"></td>'; 
Sign up to request clarification or add additional context in comments.

Comments

1

Your quotes are a bit messed up and you have an echo inside an echo.

Replace this:

echo "<td>".<img src="<?php echo base_url('uploads/'.$row->filename);?>" alt="" width="100%" height="100%">."</td>"; echo "<td><a href='updatedata?id=".$row->ID."'>Update</a></td>"; 

With this:

echo '<td><img src="' . base_url('uploads/' . $row->filename) . '" alt="" width="100%" height="100%"></td>'; echo '<td><a href="updatedata?id=' . $row->ID . '">Update</a></td>'; 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.