aspose file tools*
The moose likes PHP and the fly likes mysql_fetch_row() expects parameter 1 to be resource, boolean given Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Languages » PHP
Bookmark "mysql_fetch_row() expects parameter 1 to be resource, boolean given" Watch "mysql_fetch_row() expects parameter 1 to be resource, boolean given" New topic
Author

mysql_fetch_row() expects parameter 1 to be resource, boolean given

Gil Carvalho
Ranch Hand

Joined: Dec 10, 2013
Posts: 55
Hello

I'm having a problem returning the result of a query



The error is here





This my logcat error

<b>Warning</b>: mysql_fetch_row() expects parameter 1 to be resource, boolean given in <b>C:\xampp\htdocs\ebspmamobile\index.php</b> on line <b>47</b><br />


Any way to fix it?

Thanks
Matthew Brown
Bartender

Joined: Apr 06, 2010
Posts: 4421
    
    8

That suggests mysql_query is returning false, which it will do if there is an error. Check the value of mysql_error(), that should tell you something about what is going wrong.
Gil Carvalho
Ranch Hand

Joined: Dec 10, 2013
Posts: 55
Thanks

It was an error in name of a column but i still have an issue

This is my table times

idtempo inicio fim
------- -------- ----------
11 08:15:00 09:00:00
12 09:00:00 09:45:00
13 10:00:00 10:45:00
14 10:45:00 11:30:00
15 11:40:00 12:25:00
16 12:25:00 13:10:00
17 13:20:00 14:05:00
18 14:05:00 14:50:00
19 15:00:00 15:45:00
20 15:45:00 16:30:00
21 16:45:00 17:30:00
22 17:30:00 18:15:00

I need to check if classrrom is booked before an user can make a new booking




But i can make a new booking even if the classroom is already booked

idreserva idutilizador idsala idtempoInicio idTempoFim data
--------- ------------ ------ ------------- ---------- ----------
29 1261 1 11 14 2014-05-12
46 1261 1 15 16 2014-05-12
48 1261 1 14 15 2014-05-12

So if the classroom is booked between idtempoInicio 15 and idTempoFim 16 i shouldn't be capable of make the last booking

Whats wrong?

Thanks
Anindya Roy
Ranch Hand

Joined: May 11, 2014
Posts: 76
do something like



use mysqli_* or PDO instead of mysql_* because it has been deprecated
John David Peter
Greenhorn

Joined: Jun 06, 2014
Posts: 2
You got this error. Because your query return nothing. I request you to use die(mysql_error()) next to your mysql query. If you use this, then you'll get mysql error. Another option is, before execute query, echo the query, copy and past it to mysql database to see whether it give correct answer or not.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: mysql_fetch_row() expects parameter 1 to be resource, boolean given