Error Reporting

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
cgood
Forum Newbie
Posts: 8
Joined: Mon Aug 23, 2010 10:41 pm

Error Reporting

Post 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.
shawngoldw
Forum Contributor
Posts: 212
Joined: Mon Apr 05, 2010 3:38 pm

Re: Error Reporting

Post by shawngoldw »

Code: Select all

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


Shawn
cgood
Forum Newbie
Posts: 8
Joined: Mon Aug 23, 2010 10:41 pm

Re: Error Reporting

Post 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.
shawngoldw
Forum Contributor
Posts: 212
Joined: Mon Apr 05, 2010 3:38 pm

Re: Error Reporting

Post by shawngoldw »

Sorry can't help you there.
And ya, that semicolon was a typo, it came from me pasting from your original post.
cgood
Forum Newbie
Posts: 8
Joined: Mon Aug 23, 2010 10:41 pm

Re: Error Reporting

Post 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.
shawngoldw
Forum Contributor
Posts: 212
Joined: Mon Apr 05, 2010 3:38 pm

Re: Error Reporting

Post 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.
cgood
Forum Newbie
Posts: 8
Joined: Mon Aug 23, 2010 10:41 pm

Re: Error Reporting

Post 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.
Post Reply