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
https://forums.phpfreaks.com/topic/169669-mysql_fetch_row/
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
https://forums.phpfreaks.com/topic/169669-mysql_fetch_row/#findComment-895097
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
https://forums.phpfreaks.com/topic/169669-mysql_fetch_row/#findComment-895102
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
https://forums.phpfreaks.com/topic/169669-mysql_fetch_row/#findComment-895106
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
https://forums.phpfreaks.com/topic/169669-mysql_fetch_row/#findComment-895125
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.