Jump to content

Table doesn't find the row.


Namtip

Recommended Posts

Ultimate goal is for the query to find the row in the database to avoid the validation and carry on with the rest of the script.

 

What actually happens is the script runs without any parse errors but it doesn't find the row within mysql.

$query = sprintf('SELECT
        name_id, title, description, price, width, height, depth, quantity
    FROM
        art
    WHERE
        product_code = "$u"',
	mysql_real_escape_string($product_code, $db));
$result = mysql_query($query, $db)or die(mysql_error($db));

if (mysql_num_rows($result) != 1) {
    header('Location: home.php');
    mysql_free_result($result);
    mysql_close($db);
    exit();
}

 

I've echoed the where variable and the mysql_num_rows($result). the where variable is as expected but the result variable comes out as 0. I've checked my phpadmin and there is a entry in there. This worked fine before I sprinted the table. Any help appreciated.

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.