Page 1 of 1

help with mysql_num_rows syntax

Posted: Sat Aug 09, 2014 4:34 pm
by SXGuy
Guys, help me out here!

Code: Select all

		$rewards = $this->db->query(" SELECT customer_id, shipping_code FROM `" . DB_PREFIX . "order` WHERE customer_id = '" . (int)$data['customer_id'] . "' AND shipping_code = 'free.free'");
		$previous_rewards = mysql_num_rows($rewards);
Keep getting an error
Warning: mysql_num_rows() expects parameter 1 to be resource
What am I doing wrong?

Re: help with mysql_num_rows syntax

Posted: Sun Aug 10, 2014 1:17 am
by Tcalp
OpenCart has built-in functionality, there is no need to use the num_rows mysql calls.

Code: Select all

$previous_rewards = $rewards->num_rows;

Re: help with mysql_num_rows syntax

Posted: Sun Aug 10, 2014 1:49 am
by SXGuy
Edit: Thank you that fixed the error!