Page 1 of 1

Error Reporting

Posted: Mon Aug 23, 2010 10:47 pm
by cgood
So I've never came across this, but I'm getting a notice for an undefined index even when I have error_reporting(0) at the beginning of my script. Has anyone ever had this happen? The script works fine except for when the form is empty, which it still works as in displays all. Once you put in a search, it works. I'm having one of those "WHAT THE F*CK?" moments that we all have when coding. Its just a standard $_GET:

$q = $_GET['q'];
$cid = $_GET['cid'];

Thanks for the help.

Re: Error Reporting

Posted: Mon Aug 23, 2010 10:58 pm
by shawngoldw

Code: Select all

$q = isset($_GET['q']) ? $_GET['q']; : "";
Better?


Shawn

Re: Error Reporting

Posted: Mon Aug 23, 2010 11:08 pm
by cgood
Works great minus that first semi-colon... thanks. I saw that earlier when I was looking at solutions, but I was trying to figure out why I was still getting a notice with both error_reporting(0) and error_reporting(E_ALL ^ E_NOTICE). I was just dumbfounded on why I was getting a notice even with them turned off.

Re: Error Reporting

Posted: Mon Aug 23, 2010 11:21 pm
by shawngoldw
Sorry can't help you there.
And ya, that semicolon was a typo, it came from me pasting from your original post.

Re: Error Reporting

Posted: Mon Aug 23, 2010 11:33 pm
by cgood
Oh I know... :D I was thinking about trying eclipse cause it was incredible at finding errors when I was writing Java. You know any good editors? I'm using Dreamweaver, which I like, but I just wish there was an easier way to debug/find stupid typos like : vs ; cause my finger slipped off the shift and other crap like that.

Re: Error Reporting

Posted: Tue Aug 24, 2010 11:10 am
by shawngoldw
I'm on mac so what text editor I use probably won't help you, but I use and love textmate. I have it set up so that when I hit cmd+s for save my php gets validated. It's awesome. It comes with tonnes of crazy short cuts which you can control and modify and has made my workflow so much smoother. It's mac only but there is one called E - TextEditor which is supposed to be similar to textmate, I think it supports all of the bundles made for textmate. I honestly have no idea if it's any good or not though.

I think there is a post in the general discussion about text editors, check it out.

Re: Error Reporting

Posted: Fri Aug 27, 2010 9:23 pm
by cgood
I'm actually running a mac so that's extremely helpful. I got tired of having to spend so much time maintaining a Windows system by formatting periodically and dealing with having anti-virus so I made the switch. Running a 5-year old macbook pro that dogs any PC I had even when it was new. Limited programs does suck though. Can't have my cake and eat it too. Wish blackberry would release their eclipse plugin on macs. Seems that getting it to work is a huge hassle.