php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #19900 Mysql table with field named "exit" exits php-script when doing a if statement!
Submitted: 2002-10-14 07:48 UTC Modified: 2002-10-14 09:26 UTC
From: sk at mira dot dk Assigned:
Status: Not a bug Package: MySQL related
PHP Version: 4.2.2 OS: FreeBSD 4.1
Private report: No CVE-ID: None
 [2002-10-14 07:48 UTC] sk at mira dot dk
Reproduce bug:
--------------
-Create a table with a field name "exit". 
-Run a script like this:
<?php
mysql_connect(SQL_HOST, SQL_USER, SQL_PASS);
mysql_select_db(SQL_DB);
echo "still allive";
$result=mysql_query("select * from table");
while ($row=mysql_fetch_array($result)) {
    if ($row[exit] == "something") {
          echo "do something"; }
    else {
          echo "something else"; }
}
echo "dead allready";
?>

The problem is, that when you do a if statement on a 
$row[exit], then the php script is stoped as if you where calling "exit()";
It's only happening in a if statement with a MySQL field called exit. 

Configure line:
---------------
'./configure' '--with-mysql=/usr/local/mysql' '--with-xml' '--enable-track-vars' '--with-apache=/usr/ports/distfiles/apache_1.3.19' '--with-gd=/usr/ports/distfiles/gd-2.0.1' '--enable-ftp' '--enable-bcmath' '--with-jpeg-dir=/usr/local/lib' '--with-freetype-dir=/usr/local/lib' '--with-png-dir=/usr/local' '--with-zlib-dir=/usr/include' '--with-gettext' '--with-imap=/usr/ports/distfiles/imap-2001a'









Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-10-14 07:51 UTC] jan@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.
 [2002-10-14 07:53 UTC] derick@php.net
Use $row['exit'] (like it is documented).

Derick
 [2002-10-14 09:26 UTC] sk at mira dot dk
OK - sorry...
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 14:01:29 2024 UTC