Re: [PHP] mysql_error() problem?

2003-08-14 Thread Curt Zirzow
* Thus wrote Tyler Longren ([EMAIL PROTECTED]):
 hmmm...perhaps that was it.  When I had this issue before, someone told me
 to check mysql_affected_rows() when using issuing an UPDATE query.  I'll
 give that a shot.

Correct, mysql_affected_rows() on a query that doesn't return rows
(insert, update, delete) and use mysql_num_rows() for a select query.
 

Curt
-- 
I used to think I was indecisive, but now I'm not so sure.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] mysql_error() problem?

2003-08-14 Thread CPT John W. Holmes
From: Tyler Longren [EMAIL PROTECTED]
 I'm running an UPDATE query on my table.  After executing the query, I
check
 mysql_error() to see if there's any errors:
 if (mysql_error() == ) {
 // success
 }
 else {
 // failure
 }

 mysql_error() is always empty even if the query didn't succeed.  So it
 always thinks it succeeds.  I remember having this problem once quite a
 while ago.  I remember somebody telling me that it had something to do
with
 UPDATE.  Is there a better way to check for errors?

Please define didn't succeed... There is a difference between the query
generated an error which is caught with mysql_error() and the query did
not affect any rows which is caught by mysql_affected_rows().

---John Holmes...


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] mysql_error() problem?

2003-08-14 Thread Tyler Longren
hmmm...perhaps that was it.  When I had this issue before, someone told me
to check mysql_affected_rows() when using issuing an UPDATE query.  I'll
give that a shot.

Thanks!
Tyler

- Original Message - 
From: CPT John W. Holmes [EMAIL PROTECTED]
To: Tyler Longren [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Wednesday, August 06, 2003 3:35 PM
Subject: Re: [PHP] mysql_error() problem?


 From: Tyler Longren [EMAIL PROTECTED]
  I'm running an UPDATE query on my table.  After executing the query, I
 check
  mysql_error() to see if there's any errors:
  if (mysql_error() == ) {
  // success
  }
  else {
  // failure
  }
 
  mysql_error() is always empty even if the query didn't succeed.  So it
  always thinks it succeeds.  I remember having this problem once quite a
  while ago.  I remember somebody telling me that it had something to do
 with
  UPDATE.  Is there a better way to check for errors?

 Please define didn't succeed... There is a difference between the query
 generated an error which is caught with mysql_error() and the query did
 not affect any rows which is caught by mysql_affected_rows().

 ---John Holmes...


 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] mysql_error() problem?

2003-08-07 Thread Tyler Longren
Hi,

I'm running an UPDATE query on my table.  After executing the query, I check
mysql_error() to see if there's any errors:
if (mysql_error() == ) {
// success
}
else {
// failure
}

mysql_error() is always empty even if the query didn't succeed.  So it
always thinks it succeeds.  I remember having this problem once quite a
while ago.  I remember somebody telling me that it had something to do with
UPDATE.  Is there a better way to check for errors?

Thanks,
Tyler



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] mysql_error problem

2003-06-23 Thread Ben Edwards
I am using the below function (error_db) witch is called thus:-

  function query_db( $sql, $db ) {
$result = mysql_query( $sql, $db ) or
  error_db( $sql, $db );
return $result;
  }
But $sqlerr is always blank (it is set with  '$sqlerr = mysql_error( $db 
);').  Any idea why?

Ben

  function error_db( $sql, $db ) {

global $SERVER_NAME;
global $SCRIPT_NAME;
table_top( Database Error );

table_middle();

$sqlerr = mysql_error( $db );

echo bSQL:/b:BR$sqlbrbError:/bBR$sqlerr;

table_bottom();

// Clost of table/html from calling script
table_bottom();
html_footer();
// Send error via email

$msg  =
  Database error has accured on $SERVER_NAME\n\n..
  The error message is :-\n\n.
  SQL:$sql\n\nError:$sqlerr\n\n.
  This message was .
  generated by '$SERVER_NAME$SCRIPT_NAME';
$subj = Database error from $SERVER_NAME;

// Hard coded to minimize chance of this module erroring
$to   = [EMAIL PROTECTED];
$from = From: .$to;
mail( $to, $subj, $msg, $from );

die();
  }

* Ben Edwards   Tel +44 (0)1179 553 551  ICQ 42000477  *
* Homepage - nothing of interest here   http://gurtlush.org.uk *
* Webhosting for the masses http://www.serverone.co.uk *
* Critical Site Builderhttp://www.criticaldistribution.com *
* online collaborative web authoring content management system *
* Get alt news/views films online   http://www.cultureshop.org *
* i-Contact Progressive Video  http://www.videonetwork.org *
* Fun corporate graphics http://www.subvertise.org *
* Bristol Indymedia   http://bristol.indymedia.org *
* Bristol's radical news http://www.bristle.org.uk *

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] MySql_Error();

2002-07-04 Thread Skyhawk

Please, How do I make to get all errors of MySql ?

I'm making a function for translate all errors. Example:

function TranslateErrors($err)
{
   global $result;
   global $text;
   Switch ($err)
   {
  case 1045 :
 $text = User or Password invalid;
 Break;
  case 2005 :
 $text = Host not exists;
 Break;
  case 1049 :
 $text = Database not exists;
 Break;
   }
   result = $text;
}


Thanks



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] MySql_Error();

2002-07-04 Thread Analysis Solutions

On Thu, Jul 04, 2002 at 08:48:26AM -0300, Skyhawk wrote:
 Please, How do I make to get all errors of MySql ?
 
 I'm making a function for translate all errors. Example:

Uh, why?  PHP's mysql_error() does the job for you.
http://www.php.net/manual/en/function.mysql-error.php

If you're hell bent on your project, I don't know of a particular location
to find a list of all MySQL errors.  First try a _well_ _defined_ search
on Google.  Second, do a search on
http://groups.google.com/groups?hl=enlr=ie=UTF-8group=mailing.database
As a LAST RESORT, ask the MySQL mailing list.

--Dan

-- 
   PHP classes that make web design easier
SQL Solution  |   Layout Solution   |  Form Solution
sqlsolution.info  | layoutsolution.info |  formsolution.info
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] mysql_error()

2002-03-05 Thread GENESiS DESiGNS

Dan,

When I put 'mysql_error()' inside the 'or die();' it shows nothing when it doesn't 
connect?

Thanks,

-GENESiS DESiGNS
-Sean Kennedy 
-http://www.gdesigns.vcn.com



Re: [PHP] mysql_error()

2002-03-05 Thread GENESiS DESiGNS

Dan,

No, I telnet to gdesigns.vcn.com.

Thanks,

-GENESiS DESiGNS
-Sean Kennedy 
-http://www.gdesigns.vcn.com


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] mysql_error() not really helping

2001-02-14 Thread Christian Dechery

Christian -

You need to be checking the return values of the mysql_*() functions. Make
sure you're not calling them with a @mysql_*() as that will disable error
reporting.

Perhaps you should give us some examples of what's failing and how?

Also, if the server isn't yours the server admin may have turnd down the
level of error reporting in php so errors never even show up. See
http://www.php.net/manual/en/configuration.php and look at display_errors
and
error_reporting then check your server settings with phpinfo().

the server is local, I'm running it (apache 1.3.12)...
I set the error_reporting to the default in php.ini, I even set error_reporting(E_ALL),
but all I got were warnings about every thing PHP did, nothing MySQL related...
but nevermind, I've already fixed me a function that I call EVERY query
I run (altough I find this very annoying) that tells me when there's a sql
syntax error...

thanks



. [ Christian Dechery  ]
. Webdeveloper @ T Na Mesa!
. Listmaster @ Gaita-L
. http://www.tanamesa.com.br



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] mysql_error() not really helping

2001-02-13 Thread Christian Dechery

I'm having a little trouble here developing and running queries.

I spent some time developing in ASP, and whenever there was something wrong 
with a query, the script halted, and the error message - from ODBC, tye sql 
syntax error - was printed along with the line of code.

In PHP that's not how it goes, it doesn't tell me when theres an error with 
a mysql_query unless I place a call to mysql_error() after each executed 
query right?

That's exactly what I'm doing, but again, it doesn't do all I want, cuz it 
doesn't tell me the line of code, and I don't know where is the error, 
unless I start printing everything on error handling.

. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] mysql_error() not really helping

2001-02-13 Thread scottrus

Christian -

You need to be checking the return values of the mysql_*() functions. Make
sure you're not calling them with a @mysql_*() as that will disable error
reporting.

Perhaps you should give us some examples of what's failing and how?

Also, if the server isn't yours the server admin may have turnd down the
level of error reporting in php so errors never even show up. See
http://www.php.net/manual/en/configuration.php and look at display_errors and
error_reporting then check your server settings with phpinfo().

-- Scott

On Tue, Feb 13, 2001 at 11:31:09PM -0300, Christian Dechery wrote:
 I'm having a little trouble here developing and running queries.
 
 I spent some time developing in ASP, and whenever there was something wrong 
 with a query, the script halted, and the error message - from ODBC, tye sql 
 syntax error - was printed along with the line of code.
 
 In PHP that's not how it goes, it doesn't tell me when theres an error with 
 a mysql_query unless I place a call to mysql_error() after each executed 
 query right?
 
 That's exactly what I'm doing, but again, it doesn't do all I want, cuz it 
 doesn't tell me the line of code, and I don't know where is the error, 
 unless I start printing everything on error handling.
 
 . Christian Dechery (lemming)
 . http://www.tanamesa.com.br
 . Gaita-L Owner / Web Developer
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
 Scott

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] mysql_error() not really helping

2001-02-13 Thread David Robley

On Wed, 14 Feb 2001 13:01, Christian Dechery wrote:
 I'm having a little trouble here developing and running queries.

 I spent some time developing in ASP, and whenever there was something
 wrong with a query, the script halted, and the error message - from
 ODBC, tye sql syntax error - was printed along with the line of code.

 In PHP that's not how it goes, it doesn't tell me when theres an error
 with a mysql_query unless I place a call to mysql_error() after each
 executed query right?

 That's exactly what I'm doing, but again, it doesn't do all I want, cuz
 it doesn't tell me the line of code, and I don't know where is the
 error, unless I start printing everything on error handling.

There is a PHP constant __LINE__ which you may find useful.

-- 
David Robley| WEBMASTER  Mail List Admin
RESEARCH CENTRE FOR INJURY STUDIES  | http://www.nisu.flinders.edu.au/
AusEinet| http://auseinet.flinders.edu.au/
Flinders University, ADELAIDE, SOUTH AUSTRALIA

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]