Page 1 of 1

object to resource mysql_query

Posted: Mon Apr 11, 2011 8:47 am
by cucucur
hi! I have an java object in my php code, and I would like to cast it to a mysql_query resource, how can I do that?

Here is my error:
Warning: mysql_fetch_array() expects parameter 1 to be resource, object given
Thank you in advance!

Re: object to resource mysql_query

Posted: Mon Apr 11, 2011 1:35 pm
by fugix
can you show us the mysql_fetch_array code?

Re: object to resource mysql_query

Posted: Mon Apr 11, 2011 3:59 pm
by pickle
You're missing something. You can't have a Java object in PHP code.

Re: object to resource mysql_query

Posted: Mon Apr 11, 2011 4:15 pm
by fugix
it might not necessarily be an object. Its most likely an error in the writing of the code and the parse recognizes it as an object when its actually not

Re: object to resource mysql_query

Posted: Tue Apr 12, 2011 1:57 am
by cucucur
hi! it's actually a java variable, I'm using php java bridge:

Code: Select all

         $objeto = new Java('pruebaLog');
         $conexion = $objeto -> connectDB();
         $result = $objeto->returnParkingMapData($conexion, 2);
         mysql_fetch_array($result);

returnParkingMapData returns a java object resultSet.

fugy, how can I know if it is an object or what is it?

Thank you so much!

Re: object to resource mysql_query

Posted: Tue Apr 12, 2011 10:56 am
by pickle
Actually returnParkingMapData() would return a PHP object that you use to interact with Java.
Edit: I'm not trying to be a petty know-it-all. I just want to make sure you understand exactly what is going on.

If you want to know the type of variable, you can use gettype(). Perhaps a more useful function would be var_dump(), which dumps a bunch of different information about the variable.