turbocueca Posted April 11, 2006 Share Posted April 11, 2006 [b]A code that works:[/b][code]<form method="POST" action="">Search Word: <input type="text" name="query"><input type="SUBMIT" value="Search!"></form><?include 'db.php';if (isset($_POST['query'])) {$result = mysql_query("SELECT name,system FROM usbextreme WHERE name LIKE '%$query%'") or die (mysql_error());while(list($column1, $column2)=mysql_fetch_array($result)){echo "Result: $column1, $column2 <br />";}}?>[/code][b]My code:[/b][code]<form method="POST" action=""> Search:<input type="text" name="query"> <input type="SUBMIT" value="Search!"></form><?php if (isset($_POST['query'])) { include 'db.php'; $execute=mysql_query("SELECT name,system,work_status,postedby,comments FROM usbextreme WHERE name LIKE '%query%'") or die (mysql_error()); while (list($name,$sys,$stat,$user,$comment)=mysql_fetch_array($execute)) { echo "$name $sys $stat $user $comment"; } } else { echo "You didn't press the button!"; }?>[/code]Can someone please tell me what's wrong with my code, 'cause it doesn't search anything. Quote Link to comment Share on other sites More sharing options...
turbocueca Posted April 12, 2006 Author Share Posted April 12, 2006 problem solved, had '%query%' instead of '%$query%' Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.