ID:               31081
 Updated by:       [EMAIL PROTECTED]
 Reported By:      chippy at acornsrus dot com
-Status:           Open
+Status:           Bogus
 Bug Type:         MySQL related
 Operating System: Linux
 PHP Version:      4.3.9
 New Comment:

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.

Try to add some error checking too...


Previous Comments:
------------------------------------------------------------------------

[2004-12-14 04:52:22] chippy at acornsrus dot com

Description:
------------
When sending the MySQL query through the mysql_query() function, MySQL
does not send back a result set. But when echoing out the $sql
statement and running it directly into the MySQL database via
PHPMyAdmin or another tool, the query comes back with the intended
results. Also, running a mysql_error(); outputs nothing. So this lead
me to believe it was a bug in PHP.

Reproduce code:
---------------
define("DB_ADDY","localhost");
define("DB_USER","icesnak_eqitems");
define("DB_PW","trademasters");
define("DB_DB","icesnak_eqitems");

function find_item($types,$terms){
        if((!empty($types))&&(!empty($terms))){
                $types[] = "stock";
                $terms[] = "instock";
                $dblink = mysql_connect(DB_ADDY,DB_USER,DB_PW);
                mysql_select_db(DB_DB,$dblink);
                $sql = "SELECT * FROM `items` WHERE `". $types[0]. "` LIKE '%".
$terms[0]. "%' ORDER BY `itemname` ASC";
                $result = mysql_query($sql,$dblink);
                if(mysql_num_rows($result)){
                        echo 'Something';
                } else {
                        echo 'Nothing';
                }
        }
}

Expected result:
----------------
I would expect to get the output of "Something" since there are
multiple rows in the database that match the search criteria. I think
this issue has to do with the use of the "%" wildcard character...

Actual result:
--------------
Warning: mysql_num_rows(): supplied argument is not a valid MySQL
result resource in /home/mystuff/public_html/core/core/EQItems.php on
line 73
Nothing


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=31081&edit=1

Reply via email to