Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

bugger! lotsa mistakes :( 1

Status
Not open for further replies.

ThomasJSmart

Programmer
Sep 16, 2002
634
ok, i made this dynamic site, everything worked fine. then i thought to turn on my error repoting in php, oeps.... now theres lotsa mistakes and error msg's :( but if i turn it off everything works fine.... is this a bad thing??

the 2 most reported mistakes im getting are:

1- iv sometimes used $myrow[id] instead of $myrow["id"]
i know how to solve this, i just rename it everywhere.

2- iv used the HTTP_GET_VAR quite a lot in every single page. my idea was if it cant get the var from the address (if it isnt ther) then it would return a var="" value. i use this quite a lot.

if var="" do A
if var="1" do B

this works fine, but when i turned error reporting on its telling me it can find the var im asking for in HTTP_GET_VAR.... well yea that is the point :p
is there an error free way of getting around this??

thnx
 
1) You should always use $array["name"] when you are dealing with named array elements. This is the valid way to do it.
2) You should use the isset function to check if a variable exists. Like
Code:
if (!isset($HTTP_GET_VARS["var"]))
    // Didn't exist
else
    // It exists
//Daniel
 
wicked :) thnx very much :) the first thng i thought of and already corrected in most of my scripts, the second thing is perfect, just what i needed :)

thnx!
thomas
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top