Jump to content

Resource id #3 Error - Requires Loop?


justlukeyou

Recommended Posts

Hi,

 

Following peoples advise I have tried to add a str_replace to add a hyphen to the keyword in 'name' column.  However, when I enter a hyphen it returns a "Resource id #3" error. 

 

As far as I can tell the query needs to run through a loop to add the hyphen.  Is that correct, Im a bit confused at this stage.

 

 

if (isset($_GET['name'])) {
   $pretty_url = strtolower(str_replace(' ', '-', $_GET['name']));
   header("Location: ?linkname=$pretty_url");
}

$name = mysql_real_escape_string($_GET['linkname']);
$query = mysql_query("
    SELECT name, product_id, rrp, discount, image_link
        FROM productdbase p
        INNER JOIN furniture_groups f
            ON
                f.long_name = p.furniture_group
        WHERE
            name LIKE '%{$name}%'
    LIMIT 15");

echo $query, '<br>', mysql_error();

while ($query_row = mysql_fetch_assoc($query)) { 

Link to comment
https://forums.phpfreaks.com/topic/264731-resource-id-3-error-requires-loop/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.