Code: Select all
<html>
<style type="e;text/css"e;>
<!--
h1 {
background-color:orange;
color:#0033CC;
font-size:30px;
font-family: Verdana, Arial, Helvetica, sans-serif;
text-align:center;
}
.small_txt,
{
font-weight: bold;
font-size:12px;
font-family: Verdana, Arial, Helvetica, sans-serif;
}
body {
background-image: url(../../../../Documents%20and%20Settings/Owner/My%20Documents/My%20Pictures/images.jpg);
</style>
<body>
<h1> Oilers Search Page</h1>
<form action="e;oilers-results.php"e; method="e;POST"e;>
<table border="e;2"e; cellpadding="e;0"e; cellspacing="e;0"e; align="e;center"e; bordercolor="e;#FFA500"e;>
<tr><td width="e;125"e;><font class=small_txt><B>Enter your First Name:</B></font></td><td><input type="e;text"e; class=small_txt name="e;first"e; /></td></tr>
<tr><td width="e;125"e;><font class=small_txt><B>Enter your Last Name:</B></font></td><td> <input type="e;text"e; class=small_txt name="e;last"e;/></td></tr>
<tr><td width="e;125"e;><font class=small_txt><B>Enter Jersey No#: </B></font></td><td width="e;57"e;><input type="e;text"e; maxlength="e;2"e; name="e;number"e; size="e;2"e; class=small_txt /></td></tr>
<tr><td width="e;125"e;><font class=small_txt><B>Enter Assists: </B></font></td><td><input type="e;text"e; maxlength="e;2"e; name="e;assists"e; size="e;2"e; class=small_txt /></td></tr>
<tr><td width="e;125"e;><font class=small_txt><B>Enter Goals: </B></font></td><td><input type="e;text"e; maxlength="e;2"e; name="e;goals"e; size="e;2"e; class=small_txt /></td></tr>
<tr><td width="e;125"e;><font class=small_txt><B>Enter Points: </B></font></td><td><input type="e;text"e; maxlength="e;2"e; name="e;points"e; size="e;2"e; class=small_txt /></td></tr>
<tr><td width="e;125"e;text"e; maxlength="e;2"e; name="e;number"e; size="e;2"e; class=small_txt /></td></tr>
</table>
<P> <center>
<input type=submit value="e;Submit Info"e; class=small_txt> </center>
</form>
</body>
</html>Results Page
--------------
Code: Select all
?php
$first=$_REQUEST['first'];
$last=$_REQUEST['last'];
$number=$_REQUEST['number'];
$goals=$_REQUEST['goals'];
$assists=$_REQUEST['assists'];
$points="";
$db=mysql_connect("localhost","root") or die ("Cant connect");
mysql_select_db("oilers",$db);
$results = mysql_query("SELECT * FROM players WHERE first LIKE '%$first%' AND last LIKE '%$last%' and goals=".$goals." " ,$db ) or die (mysqlerror());
while ($row = mysql_fetch_array($results))
{
$variable1=$row["first"];
$variable2=$row["last"];
$variable3=$row["goals"];
$variable4=$row["points"];
//table layout for results
print ("First:$variable1 <BR>");
print ("Last:$variable2 <BR>");
print ("Goals:$variable3 <BR>");
print ("Points:$variable4 <BR><BR><BR>");
}
?>My issue is my query statement, I know there is something wrong with it.
Code: Select all
$results = mysql_query("SELECT * FROM players WHERE first LIKE '%$first%' AND last LIKE '%$last%' and goals=".$goals." " ,$db ) or die (mysqlerror());Right now the errors are when I included the option of searching via goals which is an int, it wont work when i try to search it with another textbox like firstname.
Currently here is what is being outputtted.
Firstname : Wayne
Won't show naything
If I try putting points,
It will output the points
What I am trying to do is have it so a person can search any textbox, ie via their firstname,lastname or how many points they have scored.
Thanks
JCART | Please use
Code: Select all
tags when posting php code. Review [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]