Love Fuel?
Donate
About
Forums
Discussions
Login
FuelPHP Forums
Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
General
Error: mysql_num_rows() expects parameter 1 to be resource, object given
Edzel
June 2016
$check_program = DB::select('program_description')->from('programs')- >where('program_description','=', $program->program_description)->as_object()->execute();
if(mysql_num_rows($check_program) > 0){
Session::set_flash('error', e('Program description already exists .'));
}else{
var_dump($check_program);die();
}
I want to check if $check_program is not empty
Edzel
June 2016
Ok I found the answer
I just change:
If(mysql_num_rows($check_program) > 0)
to
if (count($check_program) > 0)
:)
Harro
June 2016
Accepted Answer
You can't and shouldn't use mysql functions, DB returns a database result object. It has a method count(), so you can do
if ($check_program->count() > 0)
{
....
}
Add a Comment
Howdy, Stranger!
It looks like you're new here. If you want to get involved, click one of these buttons!
Sign In
Apply for Membership
Categories
All Discussions
5,088
General
↳ General
3,364
↳ Job Board
13
↳ Installation & Setup
214
Packages
↳ Oil
213
↳ Orm
700
↳ Auth
260
Development
↳ Tips and Tutorials
126
↳ Code share
145
↳ Applications
52
In this Discussion
Edzel
June 2016
Harro
June 2016