RE: [PHP-DB] DB CODEING HELP!!!!!
| From: | Daevid Vincent | Date: | Sun, 23 Mar 2003 22:32:38 +0000 |
| Subject: | RE: [PHP-DB] DB CODEING HELP!!!!! | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-26576@lists.php.net to get a copy of this message | ||
Here, this will pull data and make a select box. Adjust as needed.
$result = mysql_query("SELECT company_id, company_name FROM company_table
ORDER BY company_name", $db);
if (mysql_num_rows($result) > 0)
{
echo "<SELECT SIZE='5' NAME='edit_company_id'>\n\t<OPTION
VALUE=''>\n";
while ( $row = mysql_fetch_array($result,MYSQL_ASSOC) )
{
echo "\t<OPTION VALUE='".$row['company_id']."'";
if ($row['company_id'] == $edit_company_id) { echo " SELECTED";
}
echo ">".$row['company_name']."\n";
}
echo "</SELECT>";
}
else echo "No Companies Defined\n";
> -----Original Message-----
> From: Mike Delorme [mailto:crazymonkey1385@hotmail.com]
> Sent: Sunday, March 23, 2003 1:11 PM
> To: MySQL PHP Database Help
> Subject: [PHP-DB] DB CODEING HELP!!!!!
>
>
> this is bugging me. I have tried everything and I cant
> develop the code without an error. Can someone plese write me
> simple code that will go through a table and print 3 collums
> of that table? I cant figure it out
>