Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

Recordset: Probably an easy problem to fix?!

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

Recordset: Probably an easy problem to fix?!

Postby Neobis » Mon Sep 02, 2002 1:56 pm

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
New php-forum User
New php-forum User
 
Posts: 5
Joined: Sat Jul 20, 2002 3:42 am

Re: Recordset: Probably an easy problem to fix?!

Postby Jay » Tue Sep 03, 2002 2:16 pm

Neobis wrote: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!
Jay
 


Return to PHP coding => General

Who is online

Users browsing this forum: yetticaretti and 3 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.