I'm working on a program to print out records from a database with a 'datecompleted' that matches the current (computer) month. What I have now (not working) is comparing to an input box input, see the code below:
When queries don't work, the first think you do is create the query in mysql (using the prompt or a program like heidi/phpmyadmin) and try to make the query work without php.
When you have succeeded doing that, then is when you try to create the same query using php. If that doesn't work: echo the query to your screen to see what the difference is and try to eliminate that difference.
Thanks for the suggestions. It's obvious I'm just learning PHP. Actually I was trying to see why it wasn't working in general. I have it working now - kinda. The database containes records with a 'datecomplete' (mm/dd/yyyy) and the below program selects those fine but I really want to select from the database 'datecomplete' based on the 'mm'. ??
Warning: mysql_numrows() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\hofiles\currentmaintlog.php on line 8
Poject: Hammock Maintenance Log
Apt Name Date Received Time Received Symptom Action Date Completed
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\hofiles\currentmaintlog.php on line 20
That's because your query resulted in an error and the reason for that is that you took my example too literally.
but instead of me taking you by the hand every step of the way, you would benefit a lot from it, trying to figure out what the problem is yourself.
try to rewrite your code in such a way that you first check if the query was successful and if it's not that you output the error to the screen (or write it to a log file ... but simply outputting is easier for now) so you can see what goes wrong (in this case: what error mysql returned)
Bookmarks