Problem with WHILE using MYSQL database

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

 



Hi,
this script output's data from the database..

$data = mysql_query("SELECT * FROM firt_table WHERE cat='sweaters' ORDER BY
`id` ASC ") or die("can't find DB!");
while($line = mysql_fetch_array($data)){
echo' <tr><td width="225" height="19"'.$line['product'].'</td></tr>';
}

for example, there are 3 records in the "first_table", so script will output
only 3 records:
<tr><td width="225" height="19"'.$line['product'].'</td></tr>
<tr><td width="225" height="19"'.$line['product'].'</td></tr>
<tr><td width="225" height="19"'.$line['product'].'</td></tr>

It's ok. But I need to output 10 records always, even if there are less than
10 records in the database.

Can someone help me, please?
Lab

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux