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: <?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: 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
317 Like 33 Dislike
Previous forums Next forums
Other forums

Sending CC Info by email
I am a little bit less knowledgable in the security area as most developers and I know I have a lot

Namespace Problem
I'm having problem with a section of code with a variable namespace.

This code works fine:

weeks in a year
hi,

i found this snippet on php.net
QuoteFor the week number for weeks starting on Sunday:

CHECK A STRING FOR ' " ' (DOUBLE QUOTES)
I am checking for delimiter (.!?) and if there is a " after a sentence then it should neglect a

redirect standard error and assert (how to?)
How do you redirect standard error and assert?

---

(Why? I am creating an web app and

Production of mango in processing industry
Hi,

We have one scenario ,company is in process industry,they are manufacturing MANGO pul

Deleted Delivery but material wont return
We deleted a delivery but the material its still pending.

We made a reverse goods movemen

how to insert value
I am having file bookissueadd.php..... in which i am having tag

<td height="21&q

New to Arrays
Hi I am new to PHP (a week and a half now) and I am just beginning to read about arrays. I understan

Help with form post data and arrays
Hi all,

I am new to this forum... It has been awhile since i have worked with arrays, and i a

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