Date: Tue, 04 Feb 2003 22:02:12 +0100
To: "Leonard Burton" <[EMAIL PROTECTED]>
From: Chris Hayes <[EMAIL PROTECTED]>
Subject: Re: [PHP] Function to make a select box

Could anyone offer any suggestions?  The following function prints a blank
select box.

$result= "select auto, '$field' from '$table' order by '$field' order by
name asc";
what are these single quotes doing there? quotes in a query only go around STRINGS.
(sorry if i sound patronizing, it is late here)


$result= mysql_query($result);
for debugging code please use
$q="update members set company="\$company\", ........
$result=mysql_query($q) or
die ('<hr>DB update failed in '.__FILE__.' line '.__LINE__.'<br>Query was:'.$q.'<br>mysql reported:'.mysql_error());
you would have gotten a meaningful mysql error message!


if ($result)
this 'if' will fail with errrors, not with empty result sets


Here is a working example that is not in a function:
$result= mysql_query("select * from ledger_accounts order by name asc");
see, no quotes around the tablename here!


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

Reply via email to