A
Anonymous
Guest
edited
<?php
$connect = @mysql_connect("localhost", "JkasdfJSDF", "453609743987456") or die("could not connect to server");
$db_select = @mysql_select_db("database12") or die("could not select the database");
$SQL = "SELECT * FROM itemsearch WHERE itemname LIKE \"%$user_input%\"";
$result = @mysql_query($SQL) or die("Could not run query");
if(isset($_POST['submit'])){
if((!isset($_POST['user_input'])) || ($_POST['user_input'] == "")){
print ("Enter a search term...this will be empty");
}
else{
while($row = mysql_fetch_array($result)) {
echo("<tr>");
echo("<td class='cntbxleft'>");
$url = ("$row[url]");
echo("<a class='bluetu' href='$url'>$row[itemname]</a></td>");
echo("<td class='cntbxmid'>$row[str]</td>");
echo("<td class='cntbxmid'>$row[agi]</td>");
echo("<td class='cntbxmid'>$row[sta]</td>");
echo("<td class='cntbxmid'>$row[int]</td>");
echo("<td class='cntbxmid'>$row[wis]</td>");
echo("<td class='cntbxright'>$row[effect_one] ");
echo("</tr>");
}
}
}
?>
if(isset($_POST['submit']))
<?php
...
while($row = mysql_fetch_array($result)) {
echo("<table><tr>"); // Changed line
echo("<td class='cntbxleft'>");
$url = ("$row[url]");
echo("<a class='bluetu' href='$url'>$row[itemname]</a></td>");
echo("<td class='cntbxmid'>$row[str]</td>");
echo("<td class='cntbxmid'>$row[agi]</td>");
echo("<td class='cntbxmid'>$row[sta]</td>");
echo("<td class='cntbxmid'>$row[int]</td>");
echo("<td class='cntbxmid'>$row[wis]</td>");
echo("<td class='cntbxright'>$row[effect_one] ");
echo("</tr></table>"); // Changed line
}
...
?>
if (!isset(trim($_POST['user_input']))){ die("Enter a search term...this will be empty"); }
$user_input = trim($_POST['user_input']);
if( (!isset($user_input)) || ($user_input == "") ){ die("Enter a search term...this will be empty"); }
$user_input = trim($_POST['user_input']);
if (empty($user_input)) { die("Enter a search term...this will be empty"); }