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
How do I give a developer access to a specific directory and nothing else?
I want to give a develop access to a specific directory and nothing else
I can give them an F
I would like "for" to wait 5 sec
I would like my 'for' loop to wait 5 sec before second iteration.
for ($i=0; $i<10
file downloaded can't be read !!
<?php
$fileName = 'mypic.jpg';
$mimeType = 'image/jpeg';
header('content-dispositio
File upload issues
Hi Guys,
Can anyone see any issues with this code:
Code: $setImage= 'productimages/' . dat
A WBS element with the name XXX already exists in version FREI_VERSION
Hi.
When I am trying to insert WBS element in a project, error occurs:
"A WBS eleme
Upload file and add HTML
Hey everyone,
I have a client has meeting agendas and minutes that should be posted online. I
How to calculate days from variable date?
This will be easy for one of you gurus. I want to fetch the date from a variable date, for example:<
unoconv doc convert to pdf code prob
PHP/5.3.1
Hi. I am trying to use this code to convert docs to .pdf utilizing unoconv. Howe
uploading video files into mysql in php
hi,
I have the video files which i have to upload into mysql db. along with creating thumbnails f
start new row of pictures
on my site www.budstreasureauctions.com there is a featured auctions box that users will pay to get