[PHP-DB] php/mysql error
I am getting a weird error on one of my servers that says something about "query requires full tablescan". I was not getting this error until today that I noticed. I Googled for a minute and saw where a ton of other sites had the same problem but no "reason" why. I did find one board that said to turn off "mysql.trace_mode" in the php.ini file. I did this and it fixed the problem. Is there something different that I should be doing when I write code? Have I just "band aided" the problem or solved the problem? thanks, Doug -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] php/mysql error
please review my script I have already had it said that the script is fine, please check. IF it is then I have a set up proiblem which I would also like help to solve. BUT mysql outside of apache works fine. I started with an already set up apache so I don't know if mysql was installed in right, but the staements before the error seem to work so I would think so. I running my web server under red hat 7.0, I am new to apache/php and mysql. Thanks I get an error when it hits the line while ($row = mysql_fetch_row($rs)) {} I know it won't do anything, just checking each command. For a moment I thought this means that the mysql wan't compiled in but - then how comes the other mysql_ statements don't error. anyway the error I get is this Supplied argument is not a valid MySQL result resource ... Now I am a C++ programmer so I am estimating here, it sounds like $row - is wrong, do I need to set this up as an array (I believe that is what - it is supposed to be) The $rs is right I am pretty sure and the command should do what I want- it to do. begin 644 test2.php M/&AT;6P^/&)O9'D^"CP_"F5C:&\@)W1E3X\ '+VAT;6P^"CT@ ` end -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] php/mysql error
Always check for errors on a mysql_query() call. Like so: $result = mysql_query($cd_qry); if(!$result) { echo mysql_errno().":".mysql_error(); } That should give you an idea. Usually this error happens when your query fails for some reason and thus it doesn't return any rows. When you then try to extract rows it complains. -Rasmus On Mon, 9 Apr 2001, Liz Bander wrote: > This is the error that I've gotten since I switched servers a week-ish > ago. No idea why, doesn't make any sense to me. I'm running MySQL 3.23 > and the latest versions of Apache and PHP. We used the nusphere install. > > Warning: Supplied argument is not a valid MySQL result resource in > /usr/local/nusphere/apache/htdocs/ese-lab/Protect/add.php3 on line 162 > > Any ideas??? Thanks!!! > > Liz Bander > > This is the function that it's in: > > #== > > # sub main() { > > >if ($cancel != '') { > include '../Include/conf.inc'; > header("Location: http://$WEB_SERV/$WEB_SITE" . "search.php3"); > exit; >} elseif ($save != '') { > include '../Include/conf.inc'; > $err_str = validate(); > if ($err_str == '') { >add_log_entry($bcode); >$message = write_to_db($bcode); >#$A($message); >exit; > } else { >if (substr($err_str, -1, 1) != '!') { > $conflict_code = substr($err_str, -11, 10); > $err_str = $err_str . " href='box_edit.php3?bcode=$conflict_code&db=yes&goto=" . urlencode($goto) . > "'>-->"; >} > } >} else { > include '../Include/conf.inc'; > $cd_qry = "select max(code) from equipment"; > connecttodb(); > $result = mysql_query($cd_qry); > LINE 162$temp = mysql_fetch_row($result); > $bcode = $BCODE_START . str_pad((substr($temp[0], -6) + > 1),6,'0',STR_PAD_LEFT); >} > >include '../Include/ip_crd_tbl.inc'; >include '../Include/show_list.inc'; > > #== -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] php/mysql error
This is the error that I've gotten since I switched servers a week-ish ago. No idea why, doesn't make any sense to me. I'm running MySQL 3.23 and the latest versions of Apache and PHP. We used the nusphere install. Warning: Supplied argument is not a valid MySQL result resource in /usr/local/nusphere/apache/htdocs/ese-lab/Protect/add.php3 on line 162 Any ideas??? Thanks!!! Liz Bander This is the function that it's in: #== # sub main() { if ($cancel != '') { include '../Include/conf.inc'; header("Location: http://$WEB_SERV/$WEB_SITE" . "search.php3"); exit; } elseif ($save != '') { include '../Include/conf.inc'; $err_str = validate(); if ($err_str == '') { add_log_entry($bcode); $message = write_to_db($bcode); #$A($message); exit; } else { if (substr($err_str, -1, 1) != '!') { $conflict_code = substr($err_str, -11, 10); $err_str = $err_str . " -->"; } } } else { include '../Include/conf.inc'; $cd_qry = "select max(code) from equipment"; connecttodb(); $result = mysql_query($cd_qry); LINE 162$temp = mysql_fetch_row($result); $bcode = $BCODE_START . str_pad((substr($temp[0], -6) + 1),6,'0',STR_PAD_LEFT); } include '../Include/ip_crd_tbl.inc'; include '../Include/show_list.inc'; #==