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
8
Other forums
Save cookie to DB
I'm working on a pixel tracking script for an incentive website and I need to use an ASP script to s
Help! refer to a friend script with captcha code
Hi guys, I am posting on here in desperate need for some help with an ongoing search I have been doi
parse error
Parse error: syntax error, unexpected '[', expecting ')' in /Users/admin/Sites/phptest/array.php on
Custom CMS
This is a big custom CMS script I'd like to develop and would like some help atleast figuring out wh
Insert data in Mysql and move to another page
I'm stuck with this simple problem. I need to insert data in Mysql and then hit submit and move to a
newbie error
what is wrong with this code ?
<html>
<body>
<?
Target costs on Process orders not calculating
Hi All,
We have released standard costs for all the materials. We have also done Goods r
RFQ Configuration - can you make PLANT field an optional field in ME42
Is there a way to make the plant field on an RFQ optional in change mode (ME42)?
AutoChoosing a CSS file based on URL
Hey everyone,
I have a site that has multiple URLs and CSS files.
Based on the URL tha
Code Help.. If txt input box empty search X instead..
I am having a problem with my search script. At current it will simply search by a selected date whi