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
Lack of simpleXML Documentation
What is up with this.
Look at: http://www.php.net/manual/en/function.simplexml-load-file.php<
problem with php server update from mid 2009
Hi,
I have this navigation menu on 2 websites which used to work just fine. After a recent up
Combining refCursors and Summing
Given the following DDL:
CREATE TABLE FOODSALESTEST
("WEEKNBR" NUMBER,
"ST
Why is the logic of this simple code not working?
Hey, I'm trying to determine if a table already exists in mysql, but doing a query first with mysql_
Display last record first.
I need some help how put the last record first and first record last.
Thanks
Code: &am
Problems with returning true or false in eval()'d code
Hi guys,
Would appreciate some help with a problem when running eval() on a function that sho
IF STATEMENT HELP
Hi
i have created a calendar from a table:
Code: Calendar: October 2009
<table w
this code is strange !
Hi i got this code from the web.. It checks for live and dead socks
It is working perfectly on my
insert quotes
Hi,
I have an output like this:
Code: john,18,Cancer
How can I change this to
Code:
array ...
hi
Code: function formatCategories($categories, $parentId)
{
// $navCat stores all child