Recordset: Probably an easy problem to fix?!

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>
 
Neobis said:
when I echo the query I get:

SELECT * FROM fixtures WHERE fixtures.TeamName LIKE '%'
That should indicate to you that there is a flaw in your PHP coding! But it's not something that I can see though! I presume your server settings are correct, otherwise you wouldn't be using $_GET['TeamID'].

Try working out why you can't get the $_GET['TeamID'] value to appear correctly, then correct the fault. It should work then!
 
Back
Top