The "Freeola Customer Forum" forum, which includes Retro Game Reviews, has been archived and is now read-only. You cannot post here or create a new thread or review on this forum.
[URL]http://81.178.213.251/key/?page=2&from=0&limit=10[/URL]
Type in a product shown in the search box and hit enter and look at the error message that comes up...Can someone tell me what that error message means. The code for the search field is:
And the code for the "searchquery.php" page is:
include "connect.php";
$sql = "select * from prods where prod_id=" . $_POST['idinput'];
echo $sql;
$result = mysql_query($sql) or die(mysql_error());
while ($row = mysql_fetch_array($query)) { echo "
",$row['prod_desc'],": ",$row['idinput']; }
....and it continues but this is the part that is obviously not working. Can someone please point me in the right direction for this...thanks.
SS
> Oh.. you've made a very stupid error:
>
> $result = mysql_query($sql) or die(mysql_error());
>
> while ($row = mysql_fetch_array($query))
>
> Spot the difference.
LOL thanks, sometimes it just takes another person to look at it...wen u proof read ur own code, you see what you want to see...cheerS!
$result = mysql_query($sql) or die(mysql_error());
while ($row = mysql_fetch_array($query))
Spot the difference.
Here is the error message:
select * from prods where prod_id='AA101'
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in D:\key\searchquery.php on line 13
Here is the page if you want to play around with it...you can download it in this zip file:
[URL]http://www.ukhacking.com/phpzip.zip[/URL]
Thanks if you can help!
> $sql = "select * from prods where prod_id=" .
> $_POST['idinput'];
You need to put quotes around the variable you're searching on.
Change the above line to:
$sql = "select * from prods where prod_id='".$_POST['idinput']."'";
To make your code a little more safe use:
$sql = "select * from prods where prod_id='" .mysql_escape_string($_POST['idinput']) . "'";
This will help prevent your script failing if someone types a ' for their search.
EDIT: You may want to COPY&PASTE what I've written cos it's difficult to make out the single / double quotes properly.
[URL]http://81.178.213.251/key/?page=2&from=0&limit=10[/URL]
Type in a product shown in the search box and hit enter and look at the error message that comes up...Can someone tell me what that error message means. The code for the search field is:
And the code for the "searchquery.php" page is:
include "connect.php";
$sql = "select * from prods where prod_id=" . $_POST['idinput'];
echo $sql;
$result = mysql_query($sql) or die(mysql_error());
while ($row = mysql_fetch_array($query)) { echo "
",$row['prod_desc'],": ",$row['idinput']; }
....and it continues but this is the part that is obviously not working. Can someone please point me in the right direction for this...thanks.
SS