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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Surpressing an error using @

Status
Not open for further replies.

newphpbie

Programmer
Joined
Oct 17, 2003
Messages
110
Location
GB
I am trying to surpress an error which I get when the sql query tries to collect results before any search criteria have been inputted. I know that ultimately, using '@' to surpress errors is a bad thing, because good code doesn't produce errors. BY hey, forget about good coding for a sec and I ust want this to work without showing me any error msg's.....

The line of code I am trying to completly surpress is
Code:
$result=@mysql_query($query)or Die(mysql_error());

I've managed to surpress the first errors but I still get the error (Access denied for user: 'apache@localhost' (Using password: NO))

I thought that I could stop this error by adding an '@' just beofore 'Die' but this didn't work.

Any ideas?

Please.....

I'm thinking a complete review of layout of my code is in need, Are there any prog's out there which will scan through my code and organise it for me? I've seen it done for Java.....

 
I know...but is there a way to surpress it?
 
to elaborate... the correct output of the die() function is to output what's between the ()... so supressing the error is not going to supress the proper output. If you don't want to output any error message on that line (and I highly recommend against this, but you already knew that)
Code:
$result = @mysql_query($query);

-Rob
 
ah ha... I understand now. Thanks for the explaination...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top