#41910 [Opn->Fbk]: mysql_error doesn't return a string, just dumps output to screen
| From: | tony2001@php.net | Date: | Fri, 06 Jul 2007 15:52:52 +0000 |
| Subject: | #41910 [Opn->Fbk]: mysql_error doesn't return a string, just dumps output to screen | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-114732@lists.php.net to get a copy of this message | ||
ID: 41910
Updated by: tony2001@php.net
Reported By: dan at novapulsar dot com
-Status: Open
+Status: Feedback
Bug Type: MySQL related
Operating System: centos4.3
PHP Version: 4.4.7
New Comment:
Just put the default php.ini instead of yours and change settings one
by one to see which one causes it.
Previous Comments:
------------------------------------------------------------------------
[2007-07-06 15:50:01] dan at novapulsar dot com
Can log file settings be affecting the way this is working? I've tried
this on multiple servers, and this seems simple enough to work, but yet
it doesn't.
Do you want a link to a phpinfo page on the server this is being run on
and/or a copy of php.ini in a link?
------------------------------------------------------------------------
[2007-07-06 15:43:20] tony2001@php.net
/local/dev/php/4_4> ./sapi/cli/php /tmp/5.php
Error on page: this.php -> You have an error in your SQL syntax; check
the manual that corresponds to your MySQL server version for the right
syntax to use near 'from nothing this is broken' at line 1
I don't see any problems here.
------------------------------------------------------------------------
[2007-07-06 15:37:17] dan at novapulsar dot com
Sorry, early in the morning, I meant mysql_query().
------------------------------------------------------------------------
[2007-07-06 15:35:53] tony2001@php.net
What is mysql_execute()?
------------------------------------------------------------------------
[2007-07-06 15:30:24] dan at novapulsar dot com
<?php
//connect to valid mysql server
mysql_connect ("localhost", "user", "password") or die
(mysql_error());
mysql_select_db ("mysql") or die (mysql_error());
/* db doesn't really matter because we're trying to raise an error
based on an invalid query */
$strSQL = "select all from nothing this is broken";
$objResult = mysql_execute ($strSQL) or die (fn_Save_Error ('this.php',
mysql_error()));
/*i expect to see the string generated by the save error function,
mysql_error() as a parameter. instead, the 'return' of mysql_error goes
directly to the screen, instead of being passed as a parameter as it is
documented*/
function fn_Save_Error ($x_page_url, $x_error) {
if (strlen($x_page_url) && strlen($x_error)) {
//output if debugging is on
echo ("Error on page: " . $x_page_url . " -> " . $x_error);
//save to db
}
}
?>
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/41910
--
Edit this bug report at http://bugs.php.net/?id=41910&edit=1