Win a copy of Escape Velocity: Better Metrics for Agile Teams this week in the Agile and Other Processes forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

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

 
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Bartender
Posts: 4568
9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 80
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
do something like



use mysqli_* or PDO instead of mysql_* because it has been deprecated
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
My, my, aren't you a big fella. Here, have a tiny ad:
Garden Master Course kickstarter
https://coderanch.com/t/754577/Garden-Master-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic