473,406 Members | 2,390 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

online reference to mysql_errno() codes?

I want to do something like this:

while(false == ($result = mysql_query($query)) ) {
switch(mysql_errno()) {
case $fixableError[0]:
case $fixableError[1]:
/* fix the errors */
break;
default:
die ("Fatal error in '$query': " . mysql_error() );
break;
}
}

But I haven't found a satisfactory reference to the error codes. My
googling has returned tonnes of references to files in the PHP source,
but I'm not willing to download the source files and I doubt that
they'd have the kind of error descriptions that would be useful (like,
suggestions on how to avoid the error).

So can someone supply an address to a reference list of these error
numbers?

Also, would the syntax in the "while" clause above work in PHP?

TIA,
Will

Aug 5 '05 #1
4 2981
05.08.2005 18:26:27 Will Woodhull je napisao/la:
I want to do something like this:

while(false == ($result = mysql_query($query)) ) {
switch(mysql_errno()) {
case $fixableError[0]:
case $fixableError[1]:
/* fix the errors */
break;
default:
die ("Fatal error in '$query': " . mysql_error() );
break;
}
}


this is why "try, case, exception" is needed, but i don't miss it one bit
in php :)

--
http://mariob.blog.hr/
Aug 5 '05 #2
Thanks for the reply, Mario. Though I don't understand the relevance of
your remark.

Mario B. wrote:
05.08.2005 18:26:27 Will Woodhull je napisao/la:
I want to do something like this:

while(false == ($result = mysql_query($query)) ) {
switch(mysql_errno()) {
<snip>
this is why "try, case, exception" is needed, but i don't miss it one bit
in php :)


I know I could use PHP's try...catch construction but it seems like
overkill in the simple code I'm developing. And I think I would still
need to identify the error codes, so a reference list would still be
useful?

Maybe I'm missing something?

Aug 5 '05 #3
"Will Woodhull" <wi**@thornhenge.org> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...
I think I would still
need to identify the error codes, so a reference list would still be
useful?


A quick Google turned up (as the first hit):

http://dev.mysql.com/doc/mysql/en/error-handling.html
Aug 5 '05 #4
Dana Cartwright wrote:
A quick Google turned up (as the first hit):

http://dev.mysql.com/doc/mysql/en/error-handling.html


Thank you very much! This looks like it is what I need.

I'm going to go off into a corner now, and deal privately with the
embarrassment of having somehow managed to screw up on using Google...

Aug 6 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: lkrubner | last post by:
I'm having trouble capturing the error messages from my code which deals with MySql. In the constructor, I was getting my site's configuration info, and assigning the name of the database to a...
2
by: Gregory | last post by:
Hi, One of the disadvantages of using error handling with error codes instead of exception handling is that error codes retuned from a function can be forgotten to check thus leading to...
6
by: wizwx | last post by:
Is there anything wrong with the following code? class A { ... }; class B : public A { ... }; // definitions of class A and B, these are OK Foo() { A & a = B(); // ?? A * p = &B(); // ??...
2
by: Dave.Sun.Moon | last post by:
Dear all, I am not a professional programmer. In stead, I am using C++ mostly for my research work. My knowledge of C++ is only good enough for my computation. I really don't use the advanced...
1
by: thad.irvin | last post by:
Hey all; I'm one of those newbies to the PHP realm of programming and I've run into a stumper. What I'm trying to do is pull data (any data at this point) from a mysql database. I've checked...
12
by: Bryan Parkoff | last post by:
I write my large project in C++ source code. My C++ source code contains approximate four thousand small functions. Most of them are inline. I define variables and functions in the global scope....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.