Jump to content

help how to fix this error!!


xtops

Recommended Posts

 

 

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


 

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.