Insert image into php table

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
synical21
Forum Contributor
Posts: 150
Joined: Tue Jul 28, 2009 8:44 am
Location: London UK

Insert image into php table

Post by synical21 »

Pretty simple problem but im unable to find an answer which doesnt involve me uploading the image to the MySQL database. Basically i have a php table like this:

Code: Select all

echo "<tr>";
        echo "<td align='center'><font color='#006600'>$user_id </font></td>\n";
        echo "<td align='center'><font color='#006600'> $job_id </font></td>\n";
        echo "<td align='left'> $info </td>\n";
                echo "<td><img src ="images/tick.png"></td>\n"; <<<<<<<<<<<<<<<<< image here
i have fiddled with the line alot but still cant get it to work, I just need the image in that column on the table so that when the user clicks the image they are redirected to a new page.

Is there a way to do this but with the image on the webserver?
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Re: Insert image into php table

Post by John Cartwright »

I just need the image in that column on the table so that when the user clicks the image they are redirected to a new page.
If I understand you correctly, wrap your <img /> tag in <a></a> tags, I,e.

Code: Select all

<a href="http://yourlink.com"><img src ="images/tick.png"></a>
synical21
Forum Contributor
Posts: 150
Joined: Tue Jul 28, 2009 8:44 am
Location: London UK

Re: Insert image into php table

Post by synical21 »

Code: Select all

 echo "<tr>";
        echo "<td align='center'><font color='#006600'>$user_id </font></td>\n";
        echo "<td align='center'><font color='#006600'> $job_id </font></td>\n";
        echo "<td align='left'> $proof </td>\n";
        echo "<td><a href="link.php"><img src ="images/tick.png"></a></td>\n";
    } // END WHILE ITERATOR
    echo "</table>\n";
Still no luck the page just doesnt display anything, that is my problem. If i take out the image line the page works fine. I must be doing something wrong in that line but i dont know what.
Post Reply