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
Did you know?Explore Trending and Topic pages for more stories like this.


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 Like 8 Dislike
Previous forums Next forums
Other forums

Schedule editor
Hi,

I have a question related to Schedule editor.
If we schedule a BLS for every 30

writing a screen scraper
Hello,

I'm writing a screen scraper application and want to be able to get absolute addresses

UL and LI Add Form
The idea I want here is when the user click on a character name from the drop down select bar at the

Multiple Options for a Single Page
For this example I want to use the Handlers option which is under Fed Admin and all the related codi

php redirecting
i wont open a new thread but i have a question about redirecting....
i wonder why my code doesnt

The page should be expire when cilck back button
hi,
i'm new to php world.
i create user registration page.
when i submit it,data goes to my

Help? Need help on project with templates involving mysql and php.
I'm having a hard time explaining what I want but basically here is what I have in place:

-Da

max function question
Hi All
Ihave a table that holds shipment numbers and dates like this

select * from

Little problem with form insertion in MySQL, Please help!!!
Hi!,

I'm a little bit new with php and I have a little issue here. I created a webform to ins

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

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash