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!
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
OK
I am quite new to all this php/MySql stuff, though I feel I have managed well up until this point.
I keep receiving: "Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in...."
and I do not know how to solve the problem.
What I am trying to create is a simple login page.
I have ruled out the possiblility of the query not being recognised in MySql by running the line through MySQL itself.
I've put a few line breaks in so you can spot the problematic code
Ladies and gentlemen, i present to you the problem ....
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
I see its possible to set $un = FALSE and then putting it into the sql statement. If $un does equal false..that could be where your sql statement is bombing out. Does it happen everytime you dont have a value for username? I would set $un = '' instead.
dandare, the error message comes from trying to pass a mysql query result resource to the fetch call. You need some error checking in your code to verify that your queries are working properly in your code.
So there is an error connecting, it seems. I have checked the conn.php file which seems to be ok. No error such as not recognising the name, username or password of the database itself.
Can't think what else to try. Obivously it would not allow me to retrieve data from the database itself.
Is there any code i can use to distinguish where it all goes wrong?
In your conn.php when you do your connect, add an or die(mysql_error()); after the mysql_connect . Show us the exact error if you can't figure out whats wrong.
Warning: mysql_connect(): Access denied for user 'user'@'localhost' (using password: YES) in xxxx/test.php on line 6
Could not establish a connection: Access denied for user 'user'@'localhost' (using password: YES)
What MySQL server version are you running and what is your MySQL Client API version? The MySQL version can be found in phpMyAdmin or by running this query: