Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

AJAX No result on Query from MySql

I dont know maybe I am a bit stupid but I am trying to see how to build up a online booking system with avalible appointmet showing up in green and unavalible in red. However I wounder if I have someone booked in a time I will get a boolean telling me that that hour on that day is already booked. But if its not booked I will get no result from the database and the object is empty when it arrives in php. And now I wounder if I can, somehow get a boolean false into a json file or if I can have a backupfile that jumps in if i get a no reply

Maybe someone out there can tell me something to help me out.

1 Answer

Steven Parker
Steven Parker
243,656 Points

Perhaps you don't need to force a false result. If the default is to be available (green), then you just change it to unavailable (red) only if the query returns a result at all.

Wouldn't that do what you want?

Wow did not think about that...yes that is exacly what I wanted...Thank you