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
Not sure why this script is not working?
Hi I am new to php programing and I was trying to make up a simple script like a captcha but I canno
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
Website Direction...
I recently used this code to try and make it so the page loads as http://www.domain.com/ when you ty
Request-URI Too Large
I have created a simple submit form for a mysql database that puts a piece of code into database.<
How to file_get_contents when login required?
Hello!
I am trying to read data from a page that you have to be logged into to view, I am try
SELECT * FROM users WHERE Users are not in Blocked
How do I select all users from users table where there users_id is not stored in the block table
md5 is it unique
I know this is most likely one of many simple questions that can be found semi easily. But I'm press
Calling variables
I want to call this to my website but it doesn't display what I want it to,
Code: <h5&
defining website tags
Hi,
What would be the best way to define tags for my site, such as website title, url etc.
Interpret Order
Hello all,
I'm wondering if I have this:
Code: $switch = array(
'one' =>