RE: DB CODEING HELP!!!!!

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

 



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:  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
> 


-- 
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