I am problems with obtaining a variable form the previous page.
I am being told "You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1"
Here is the code which triggers the action
print "<td><a href = 'search.php?id=$style'><img src='$test' width='128' height='85' alt='Click here to see more info on this shoe'></a></td>";
The code on the second page is
$style = $_GET["$style"];
$sql = "SELECT * FROM tblShoestest where StyleID like $style";
$resultID = mysql_query($sql, $linkID)or die(mysql_error());
Am i asking for the wrong thing? should i be asking for id?
What I want to happen is then the picture is clicked on, the next page goes and does a query to find out more and display
Any help appreciated
Problem with parsing varible
Moderator: General Moderators
-
nutstretch
- Forum Contributor
- Posts: 104
- Joined: Sun Jan 11, 2004 11:46 am
- Location: Leicester
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
and don't forget to put quotes around strings in SQL:
Mac
Code: Select all
$sql = "SELECT * FROM tblShoestest WHERE StyleID='{$_GET['style']}'";