Re: hi whats wrong with this code

From: Date: Sun, 07 Oct 2001 02:58:18 +0000
Subject: Re: hi whats wrong with this code
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-70267@lists.php.net to get a copy of this message
> <? > $conn = db_connect(); This didn't work, and you have no error-checking, so you didn't notice, and march blindly forward over the cliff... For a production server, a simple and reasonably safe thing to do would be: $conn = db_connect() or error_log(__FILE__ . ' ' . __LINE__ . ': ' . mysql_error()); You'll have to: tail /path/to/apache/error_log The path could easily be /etc/httpd/logs or /usr/local/apache/logs/ or, well, just about anything if you worked at it when you compiled Apache... You could also change php.ini to change where errors are logged if you want to pull them out from Apache's errors... > if (empty($HTTP_POST_VARS["HelpDeskID"])) > { > $CurrentID=1; > } > else > { > > $CurrentID=$HTTP_POST_VARS["HelpDeskID"]; > } > > $RSHelpDesk_query=mysql_query(("select QorA, Message from CSHelpDeskEntries where " > ."HelpDeskID = ".$CurrentID),$conn); Here, $conn isn't any good, and you're trying to use it, but even if it was, if your SQL was wrong, you have no error checking and will walk off another cliff. Also, the concatenation (.) and inner ()'s are kinda silly. > $RSHelpDesk=mysql_fetch_array($RSHelpDesk_query); > > if($RSHelpDesk["QorA"] == 'A') { > header("Location: http://www.thegardenzone.co.nz/login/wizardanswer.php?HelpDeskID=.$CurrentID ", false); > } > > $RSItems_query = mysql_query(("select Response, GoToID from CSHelpDeskEntryItems where " > ."HelpDeskID = ".$CurrentID),$conn); > > $RSItems = mysql_fetch_array($RSItems_query); > > ?> > > i get this error message arguement supplied not a valaid resource > > thanks in advance from new zealand -- WARNING richard@zend.com address is an endangered species -- Use ceo@l-i-e.com Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm

« previous php.general (#70267) next »