Jump to content

Custom MySQL Error [HELP]

- - - - -

  • Please log in to reply
4 replies to this topic

#1
bbqroast

bbqroast

    Codecall Addict

  • Members
  • PipPipPipPipPipPipPip
  • 554 posts
  • Location:/etc/passwd
Well its me again!
I am writing some fancy code and I decided that the MySQL (can't jump to...) error was not what I wanted my users to see when they got the wrong page ID. So i changed the code to:
$body = mysql_result($data,0,"Body") or die("Page not found!");
Sadly however it still returns:
Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 5 in C:\web-server\thehub\framed.php on line 11

Page not found!
Well at least i managed to get the Page not found! part in, so anyone know how to remove the MySQL generated part??
Please, write clearly with proper structure. Double spacing makes the text feel un-jointed, Capitalizing Every Word Means People Stop Before Every Word Sub-Consciously Which Is A Pain In The Backside, and use code tags! (The right most styling box).

#2
Alexander

Alexander

    It's Science!

  • Moderators
  • 4,124 posts
  • Location:Vancouver, Eh! Cleverness: 200
You will notice this is a warning, in fact E_WARNING in the engine. You can leave errors on and turn warnings off with the following line of code, provided you have placed this at the top of your code and have allowed changing of settings in run time.

For example:

error_reporting(E_ALL & ~E_WARNING);
You will notice this uses bitwise manipulation operators, so you can easily add your own options or constraints.
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.

#3
__ak

__ak

    Newbie

  • Members
  • PipPip
  • 24 posts
@Alexander

Just out of curiosity; what is the difference between your code and this?
error_reporting(E_ALL^E_WARNING);


#4
Alexander

Alexander

    It's Science!

  • Moderators
  • 4,124 posts
  • Location:Vancouver, Eh! Cleverness: 200
For this specific task they will produce the same result.

Why I do not suggest using your mentioned method; If you apply an exclusive OR to E_ALL and E_STRICT (which is set to OFF in E_ALL) it will enable it, which you presumably did not intend. A very simple example:
0001011111111111 ( E_ALL )
0000100000000000 ( E_STRICT )
0001111111111111 ( E_ALL ^ E_STRICT )
0001011111111111 ( E_ALL & ~E_STRICT )

Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.

#5
__ak

__ak

    Newbie

  • Members
  • PipPip
  • 24 posts
Thanks alot!
Makes great sense.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users