whats wrong with my code please help!!!
         
               Posted on 
16th Feb 2014 07:03 pm by  
admin
        
        this is the error
Warning: mysql_close(): supplied argument is not a valid MySQL-Link resource in /var/www/IpSearch.php on line 
Code: [Select]<?php
$srch = $_REQUEST["srch"];
if (empty($srch)) {
    print <<<HERE
    <form>
    Type the Store location:
    <input type = "text"
           name = "srch">
    <input type = "submit">
    </form>
HERE;    
} else {
        $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($srch)")) {    
            $um_rows = mysql_num_rows($result);
            if($num_rows <= 0) {
                echo "no match found";
            }    
            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>nn";
                }//end while-
            print "</table>n";
        } else {
            trigger_error(mysql_error(),E_USER_WARNING);  //this will display MySQL's error message
        } 
}
mysql_close($con)
?> 
Code: [Select]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       
      
       
		No comments posted yet	
	Your Answer:
	        Login to answer
        
296  
 8 
 
    
    
 
Other forums
Add code to enable passing of checkbox variable on login 
Ok, I have a login page, but want to add a checkbox that when checked and successful login is made i
writing a screen scraper 
Hello,
I'm writing a screen scraper application and want to be able to get absolute addresses
getting rid of quotes in strings 
sick of trying to deal with them in multiple ways (entering in and taking from database, echoing, ec
Echoing a Variable from a Object 
How do I get a variable from the new User Class to echo out in this clasS?
class MyApp
{
Undefined index on my form 
ok im getting Undefined index on this line.. print_r($_REQUEST['form']);
below is the full sc
An odd assignment statement. Can someone explain this assignment to me? 
What purpose is served by the bit of code between the two equal signs in the $installurl set?  Is th
Echo Tweaking help! 
HI. I would like to have the output of the entered variables repeat forever, but it's stopping at th
TinyMCE / Ajax Postback Problem 
Hiya all,
I have a page which loads the TinyMCE editor. On the postback I obviously want to f
Pop-up Banner 
Hello Friends,I need to use banner in our client site.Example: www.example.com if i enter this site 
Getting the full city list from maxminds geoip database 
I am suprised I can't find any references to this.
I have maxminds geoip lite installed and i