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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.