Jump to content

search query in mysql in php problem


edrew04

Recommended Posts

my search query wont work, i know, that my codes are correct.please help

 

<table width="300" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<div id="insidebox1">
<form name="form3" method="POST" action="<?php echo $_SERVER['PHP_SELF']; ?>">

<tr><td><p>physician_ID: <td><input type="text" name="pat5" id="pat5" size="15" maxlength="11" value=""/></p></td></tr>
<tr><td><p><input type="submit" name="btn7" id="btn7" value="Search Physician"/></p></td></tr>


</form>
</div>
</table>

<?php
if (isset($_POST['btn7'])) { echo "<center/><a href='physicians.php'>Check the search results
</a></p>";
mysql_query("SELECT * FROM physicians WHERE Physician_ID={$_POST['pat5']}") or die (mysql_error());

}
?>

Link to comment
https://forums.phpfreaks.com/topic/176698-search-query-in-mysql-in-php-problem/
Share on other sites

Well, this tag appears invalid, not that it has anything to do with the problem:

 

<center/>

 

and you never close the center tag off

 

Aside from that are you getting errors etc.? You say you "know" your code is correct, yet it does not work... either you or your code is wrong :)

 

I will assume you have connected to the db somewhere outside of your code, have you tried to echo out the query to see if it looks right? You could also then run the query with something like phpmyadmin to see if it runs directly against the db.

 

As I look a bit closer, what you're doing in the if doesn't make much sense, could you post the rest of the code?

Well, this tag appears invalid, not that it has anything to do with the problem:

 

<center/>

 

and you never close the center tag off

 

Aside from that are you getting errors etc.? You say you "know" your code is correct, yet it does not work... either you or your code is wrong :)

 

I will assume you have connected to the db somewhere outside of your code, have you tried to echo out the query to see if it looks right? You could also then run the query with something like phpmyadmin to see if it runs directly against the db.

 

As I look a bit closer, what you're doing in the if doesn't make much sense, could you post the rest of the code?

yeah, i echoed my table, but when it comes to  search, i only want the id which is 1 to be shown, but other id's are showing even they were not id number 1. it shows that, my search query is as the same as my echo the whole table

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.