Jump to content

mysql_fetch_row


slawrence10

Recommended Posts

		$product_orders_options = $this->db->query("SELECT * FROM " . DB_PREFIX . "order_option WHERE order_product_id = '" .(int)$product_id. "' AND name = '" . $thedate . "' AND value = '".$product_option_value['product_option_value_id']."'");

			echo mysql_num_rows($product_orders_options);

 

I've tried to do a simple query and then count the results but i'm getting the following error:

 

Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /homepages/32/d126974997/htdocs/kwtables/catalog/model/catalog/product.php on line 205

 

any idea why the row count isn't working?

 

Thanks for your time,

Scott

Link to comment
Share on other sites

When I see DB_PREFIX I think of a format like this:

 

kwOC.order_option

 

DB_PREFIX being the database (DB) and order_option being the table name.  Notice the dot between the database name and the table name.  That's how I would interpret your code.

Link to comment
Share on other sites

		$product_orders_options = $this->db->query("SELECT * FROM " . DB_PREFIX . "order_option WHERE order_product_id = '" .(int)$product_id. "' AND name = '" . $thedate . "' AND value = '".$product_option_value['product_option_value_id']."'");

			echo mysql_num_rows($product_orders_options);//look <<<

Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /homepages/32/d126974997/htdocs/kwtables/catalog/model/catalog/product.php on line 205

Link to comment
Share on other sites

sorry that's just me being a retard between trying things and copying the wrong stuff the error is:

 

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /homepages/32/d126974997/htdocs/kwtables/catalog/model/catalog/product.php on line 203

 

so yes my topic is now wrong :/

Link to comment
Share on other sites

I'm a bit confused though,

 

basically I'm editing a controller file within OpenCart

 

and have just taken the format of the other queries which use $this->db->query

 

is it maybe because $this->db->query has already been called once in that given function?

 

Regards,

thanks for your help!

 

Scott

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.