Using Apache, PHP and MySql:
the code
Form used to build SQL Query:
___________________________________________________
<html><body>
<form name="stuff" " method="post" action="display.php">
Fname<input type="text" name="fname"></input><br>
Lnameinput type="text" name="lname"></input><br>
<input type="submit" value="click"></input>
</form>
</body></html>
_________________________________________________
The Query and Results Page
__________________________________________________
<?
$db_name = "test";
$table_name = "test";
$connection = @mysql_connect("localhost", "jasond", "jasond") or die ("Could not connect.");
$db = @mysql_select_db($db_name, $connection) or die ("no db connection");
$sql = "select * from $table_name where fname like '$fname%' and lname like '$lname%'";
$result = @mysql_query($sql,$connection) or die ("damn2");
while ($row = mysql_fetch_array($result)) {
$fname = $row['fname'];
$lanme = $row['lname'];
$display_block .= "
<b>$fname<b><br>
<p>$lname</p>
";
}
?>
<html>
<body>
<? echo "$display_block"; ?>
</body>
</html>
______________________________________________________
This was working locally on my machine, NT Worksation.
I have the equivalant setup, as far as I can tell on a NT Server now.
I access the web page over my Intranet and the SQL Select statment will not work. Instead of the returning Records based on my search, it returns all Records in the Data Base.
Combinations of changing ("localhost", "jasond", "jasond") will either cause a "Could Not Connect Error" or again, the page displaying all records and not what I am searching for.
Very confused. It works on my machine locally, but when I try to access the Page remortely, the SQL query is ignored, yet displays all records.
Any ideas????? please.....................


input type="text" name="lname"></input><br>



Bookmarks