PHP - How to use Php inside Php?

Posted by Dodi300 on Stack Overflow See other posts from Stack Overflow or by Dodi300
Published on 2010-04-14T21:57:40Z Indexed on 2010/04/14 22:03 UTC
Read the original article Hit count: 531

Filed under:
|
|
|
|

Hello. Can someone tell/show me how to use PHP inside PHP. I'm trying to make the URL of an image change depending on what value is in a MySQL database. Here's an example of what I'm trying to do. Bear in mind that $idx already has a value from the URL of the page.

<?php
$query  = "SELECT * FROM comment WHERE uname='$idx'";
$result = mysql_query($query);
while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
echo "<img src='' name='comm' width='75px' height='60px' id='mainimage' />";
}
?>

How would I make the source value, for the image, come from a different table?

© Stack Overflow or respective owner

Related posts about php

Related posts about inside