Re: New to PHP/MySQL - Need help with images

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



how about like this:

echo "<table>\n<tr>";
$result = @mysql_query("SELECT image FROM specials");
while($row = mysql_fetch_row($result)) {
   echo "<td><img src=" . $row[0] . " /></td>\n";
}
echo "</tr>\n</table>\n";

hope it helps!
matt

On Jan 5, 2008 4:51 PM, Thomas <thomashw@xxxxxxxxx> wrote:

> I'm attempting to make a table with one row and 3 columns holding three
> different images. I want each image URL to be called from my database.
> Everything is set-up in my database. When I use the following code, it
> places the same picture across the three columns and does this three times
> (creating three rows.) I want a different picture to be placed across the
> three columns and to have only one row. What can I do?
>
> Here is the code:
>
> $result = @mysql_query('SELECT image FROM specials');
> $num=mysql_numrows($result);
> $i = 0;
> while ($i < $num) {
> $image=mysql_result($result,$i,"image");
> ?>
> <table>
> <tr>
> <td>
> <img src="<? echo "$image"; ?>">
> </td>
> <td>
> <img src="<? echo "$image"; ?>">
> </td>
> <td>
> <img src="<? echo "$image"; ?>">
> </td>
> </tr>
> <?
> $i++;
> }
> echo "</table>";
> ?>
>
> --
> Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux