Possible duplicate:
mysql_fetch_array () expects parameter 1 to be a resource, boolean is set to select
I get the message below when I run this script:
Warning: mysql_fetch_row () expects parameter 1 to be a resource, the line is specified in /var/www/html/toolkit/routing.php on line 12
I ran the query in mysql console and it will print the correct line. Not sure why I can't display it in php?
routing.php page:
<?php error_reporting(E_ALL); ////error_reporting(0); ini_set('display_errors', 'On'); include("db/sbc_config.php"); include("db/mysql.class.php"); $db = new MySQL(true, DB_DATABASE_ROUTING, DB_SERVER, DB_USER , DB_PASS); if ($db->Error()) $db->Kill(); $searchroute = "SELECT * FROM destination_route as d WHERE d.destPrefix='2146811'"; $result = mysql_fetch_row($searchroute); echo $result; ?>
sbc_config.php:
<?php //database server define('DB_SERVER', "10.10.1.146"); //database login name" define('DB_USER', "user"); //database login password define('DB_PASS', "pasword"); //database names define('DB_DATABASE_ROUTING', "routing"); //smart to define your table names also define('TABLE_DESTINATION_ROUTE', "destination_route"); ?>
source share