A
Anonymous
Guest
I am having a problem with my php page. When I change the variable in the web address (TeamID) it keeps giving me the first record in the db. See code below.
When I try http://www.mysite.com/test.php?TeamID=Queens
I get the first team in my db which is Aberdeen when it should give me Queens, it always gives me Aberdeen? I am doing some really stupid.
Any assistance would be greatly appreciated.
Also when I echo the query I get:
SELECT * FROM fixtures WHERE fixtures.TeamName LIKE '%'
N
===================
<html>
<head>
</head>
<body>
<?
$db_handle = mysql_connect("xxx.xxx.xxx.xxx","username","password") or die (mysql_error());
mysql_select_db("mydb",$db_handle) or die (mysql_error());
$sqlVar="SELECT * FROM fixtures ";
{
$sqlVar.="WHERE fixtures.TeamName LIKE
'%".$_GET['TeamID']."'";
}
$myquery = mysql_query($sqlVar,$db_handle) or die (mysql_error());
$rs = mysql_fetch_array($myquery)
?>
<TABLE width="600" border="0" cellpadding="0" cellspacing="0">
<TR>
<TD width="600" height="35" valign="middle" align="center" class="maincolor">
<P class="title"><?=$rs["TeamName"]; ?> Fixtures 2002/03</P>
</TD>
</TR>
</TABLE>
<?
echo $sqlVar
?>
</BODY>
</HTML>
When I try http://www.mysite.com/test.php?TeamID=Queens
I get the first team in my db which is Aberdeen when it should give me Queens, it always gives me Aberdeen? I am doing some really stupid.
Any assistance would be greatly appreciated.
Also when I echo the query I get:
SELECT * FROM fixtures WHERE fixtures.TeamName LIKE '%'
N
===================
<html>
<head>
</head>
<body>
<?
$db_handle = mysql_connect("xxx.xxx.xxx.xxx","username","password") or die (mysql_error());
mysql_select_db("mydb",$db_handle) or die (mysql_error());
$sqlVar="SELECT * FROM fixtures ";
{
$sqlVar.="WHERE fixtures.TeamName LIKE
'%".$_GET['TeamID']."'";
}
$myquery = mysql_query($sqlVar,$db_handle) or die (mysql_error());
$rs = mysql_fetch_array($myquery)
?>
<TABLE width="600" border="0" cellpadding="0" cellspacing="0">
<TR>
<TD width="600" height="35" valign="middle" align="center" class="maincolor">
<P class="title"><?=$rs["TeamName"]; ?> Fixtures 2002/03</P>
</TD>
</TR>
</TABLE>
<?
echo $sqlVar
?>
</BODY>
</HTML>