PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I am very new to php. Currently I'm trying to extract data from a table in my database and put it in a drop down box but I keep getting this error.
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\Program Files (x86)\EasyPHP-5.3.3\www\72793775\student_reg.php on line 9
shauns2007 wrote:
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\Program Files (x86)\EasyPHP-5.3.3\www\72793775\student_reg.php on line 9
This usually means that your query is coming back empty. Did you check your table/field names, and make sure that the records exist in the db? ie, you have a table named courses and 2 columns 'cid' and 'cname'? and that there are records in the table?
shauns2007 wrote:
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\Program Files (x86)\EasyPHP-5.3.3\www\72793775\student_reg.php on line 9
This usually means that your query is coming back empty. Did you check your table/field names, and make sure that the records exist in the db? ie, you have a table named courses and 2 columns 'cid' and 'cname'? and that there are records in the table?
yes, I changed the code and now the error is gone but it's not pulling anything from my db. The table has 7 fields in it. My new code as follows
danwguy wrote:That's what I was thinking too, you are calling for select from course, not courses, are you sure the table is named course and not courses?
shauns2007 wrote:
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\Program Files (x86)\EasyPHP-5.3.3\www\72793775\student_reg.php on line 9
This usually means that your query is coming back empty. Did you check your table/field names, and make sure that the records exist in the db? ie, you have a table named courses and 2 columns 'cid' and 'cname'? and that there are records in the table?
It seems my query is coming back empty as I tried a print_r statement but I get nothing. As follows