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!
Can somebody help me please? I cannot find where i am going wrong! I have checked the manual and still cant see anything.
I am createing a form that will auto fill the fields once complete so that when a member returns to the form the fields they have already filled in are there. I have the rest of the form working its just getting the data from the db and into the correct fields. Here is the query i have so far.
BYB_ID iscrai8088 STARS is SITEDATA isResource id #21 MY_QUERY isSELECT * FROM byb_players WHERE BYB_ID = 'crai8088' row isArraySELECT * FROM byb_players WHERE BYB_ID = 'crai8088'
The second line is what i want BYB_ID is working fine its the SITEDATA is resource id #21 this should return a text value not a number value. Sorry i aint all that clued in on words and phrases i hope you understand.
BYB_ID iscrai8088 STARS is SITEDATA isResource id #21 MY_QUERY isSELECT * FROM byb_players WHERE BYB_ID = 'crai8088' row isArraySELECT * FROM byb_players WHERE BYB_ID = 'crai8088'
The second line is what i want BYB_ID is working fine its the SITEDATA is resource id #21 this should return a text value not a number value. Sorry i aint all that clued in on words and phrases i hope you understand.
Thanks
$SITEDATA is your MySQL Result Resource return from the call to mysql_query(). You cannot 'echo' the value of a Result Resource, you must use mysql_result() or one of the mysql_fetch_* functions to fetch the data based on that result. Having said that, you do actually use mysql_fetch_array() in your script, with the result being assigned to the array $row; ergo, you need to access $row['STARS'].
Something else you should be aware of, it is much more practical and better practice to perform the SELECT statement on the column you want, not all records '*'. If all you require is the 'STARS' column, I'd change the query to