xtops Posted October 23, 2009 Share Posted October 23, 2009 Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /var/www/IpSearch.php on line 18 <?php $con = mysql_connect("localhost","root","icebird"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("IpPhoneDir", $con); /* Send a query to the server */ if ($result = mysql_query($con, "call GetBranchBeg('gsc')")) { print "<table border = 1>\n"; //get row data as an associative array While ($row = mysql_fetch_assoc($result)) { print "<tr>\n"; //look at each field foreach ($row as $col=>$val){ print "<td>$val</td>\n"; }//end foreach print "</tr>\n\n"; }//end while- print "</table>\n"; }//end if /* Close the connection */ mysql_close($con) ?> this is the content of my stored procedure DROP PROCEDURE `GetBranchBeg`// CREATE DEFINER=`root`@`localhost` PROCEDURE `GetBranchBeg`(IN starts_with CHAR(15)) BEGIN DECLARE tmp CHAR(15); SET tmp = CONCAT(starts_with, '%'); SELECT IpPhoneNo, location FROM IpPhoneList WHERE location LIKE tmp OR location =starts_with; END Quote Link to comment Share on other sites More sharing options...
Mchl Posted October 23, 2009 Share Posted October 23, 2009 Try if ($result = mysql_query($con, "call GetBranchBeg('gsc')")) { //rest of your code } else { trigger_error(mysql_error(),E_USER_WARNING); //this will display MySQL's error message } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.