Forum Moderators: coopster

Message Too Old, No Replies

Scripts fail on SQL compairs

         

mims1979

2:17 am on Feb 1, 2007 (gmt 0)

10+ Year Member



I recently reloaded a development server and when I launched off some existing scripts I started getting "this page cannot be displayed" errors on any pages that contain a compairison like:

$row_users = mysql_fetch_assoc($resultusers);
do {
$data .= "<option value=" . $row_users['id'];
if (($row_users['id'] == $_GET['mid'])){$tdata .= " selected";}
$tdata .= ">" . $row_users['email'] . "</option>";
} while ($row_users = mysql_fetch_assoc($resultusers));

As long as I pass the?mid=1 in the URL I can pull up the page, but as soon as I remove the?mid=1 from the URL I get page can't be displayed.

In the same instance, if I replace $_GET['mid'] with "1" or some other string it works fine. Its only if I compare any sql record to another variable that it dies.

I've tried everything I know but I've got 3 places in this script that do similar functions and in all three locations it dies.

I've also got a couple outer random errors as well but I haven't tracked it down but it seems to be related to the above problem.

Is there some settings in PHP or MySQL that I missed?

mims1979

2:42 am on Feb 1, 2007 (gmt 0)

10+ Year Member



Well, I suppose I solved it. I have enabled E_ALL on error reporting on the new server (hoping to see warning so I'd make cleaner code) but during this troubleshooting I got sick of seeing misc Notices so I set it to error_reporting = E_COMPILE_ERROR¦E_RECOVERABLE_ERROR¦E_ERROR¦E_CORE_ERROR.

Everything works like a charm now. I guess it was just some errors killing my output and it wasn't telling me anything in the browser.

mcibor

4:38 pm on Feb 1, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Next time start with E_ALL and correct all notices on the fly.
I usually don't have any notices in my scripts ;)

Michal

mims1979

9:41 pm on Feb 1, 2007 (gmt 0)

10+ Year Member



And that was my intention, but at this point I suppose the notices are screwing up my output and it won't even tell me what the notices are. Any ideas on how to get around that? Is there some sort of logging I can enable on PHP so it would log all notices?

eelixduppy

10:02 pm on Feb 1, 2007 (gmt 0)




Is there some sort of logging I can enable on PHP so it would log all notices?

You have to change the values in your php.ini file to allow for all notices/errors/warnings by changing the value of error_reporting [us2.php.net]. If you do not already have an error_log [us2.php.net], you might want to create one.

Also, you should turn off display_errors for a production site.

mims1979

11:01 pm on Feb 1, 2007 (gmt 0)

10+ Year Member



Thanks, that worked perfectly. Now all the errors goto a log instead of in the output.