RE: [PHP-DB] sql errors?
is register_globals set to off in php.ini? this may be the issue if it is set to on. -Original Message- From: Jas [mailto:[EMAIL PROTECTED] Sent: 15 December 2003 22:50 To: [EMAIL PROTECTED] Subject: [PHP-DB] sql errors? I have checked and rechecked my code on these php to mysql statements and for some reason I either get no data (through php, where through a command line I get all the data I need) or errors on the update function. Could someone tell me what I am doing wrong? $sql = mysql_query(SELECT hostname FROM $table WHERE vlan = $_POST[dhcp_hosts],$db)or die(mysql_error()); from the command line SELECT hostname FROM hosts WHERE vlan = 'Vlan-22'; And I get results... I don't get it. And for the update statement I am having problems with... $sql_global = mysql_query(UPDATE $tble SET dn = '$_POST[dn]' SET lt = '$_POST[lt]' SET mlt = '$_POST[mlt]' SET msc01 = '$_POST[msc01]' SET msc02 = '$_POST[msc02]' SET msc03 = '$_POST[msc03]' SET msc04 = '$_POST[msc04]' WHERE id = '1',$db)or die(mysql_error()); If you echo the posted vars they are all present and the same statement works in other places of the script and from the command line. Any help is appreciated. Jas -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] sql errors?
On Mon, Dec 15, 2003 at 03:49:31PM -0700, Jas wrote: $sql = mysql_query(SELECT hostname FROM $table WHERE vlan = $_POST[dhcp_hosts],$db)or die(mysql_error()); Maybe like this? $sql = mysql_query(SELECT hostname FROM $table WHERE vlan = '. $_POST[dhcp_hosts].',$db)or die(mysql_error()); -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php