RE: [PHP-WIN] this is so difficult for me
| From: | Donatas | Date: | Sun, 24 Aug 2003 11:15:20 +0000 |
| Subject: | RE: [PHP-WIN] this is so difficult for me | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-21227@lists.php.net to get a copy of this message | ||
This is how I would do it
<?
mysql_connect('localhost', '', '');
mysql_select_db("myshop");
$result= mysql_query("select * from productlist where id=$mn") ;
$cnt = mysql_num_rows($result);
$columns = 5; //number of columns in your table
for ($i = 0; $i != ceil ($cnt / $columns); $i++)
{
echo '<tr>'
for ($j = 0; $j != $columns; $j++)
{
$row = mysql_fetch_array($result);
$_SESSION["picture(".($i * $columns + $j).")"] = $row["pictures"];
echo "<td><img src=". $row["pictures"] ."></td>"
;
}
echo '</tr>';
}
?>
Sorry if there are any bugs here, I didn't test it :)
Cheers,
Donny
-----Original Message-----
From: Thomas Edward Lawrence [mailto:goodboy@fptnet.com]
Sent: Sunday, August 24, 2003 11:56 AM
To: php-windows@lists.php.net
Subject: [PHP-WIN] this is so difficult for me
I have an array $row["pictures"] which includes 15 pictures , I want to
echo it like this , this is so difficult for me ,
picture1 picture2 picture3 picture4 picture5
picture6 picture7 picture8 picture9 picture10
picture11 picture12 picture13 picture14 picture15
this is my code ;
<?
mysql_connect('localhost', '', '');
mysql_select_db("myshop");
$result= mysql_query("select * from productlist where id=$mn") ;
$i = 0;
$cnt = mysql_num_rows($result);
while ($i <= $cnt)
{
$row = mysql_fetch_array($result) ;
$i++ ;
$_SESSION["picture($i)"] = $row["pictures"] ;
echo "<tr><td><img src=". $row["pictures"]
."></td></tr>" ;
}
?>
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php