aussiefly Posted December 30, 2007 Share Posted December 30, 2007 Hi everyone! I'm a rank beginner with PHP and MYSQL and i'm trying to put together a members login script etc. At the moment i'm creating the reset your password part of the login page and i'm having trouble fetching some data out of the database. Heres my code: <?php require_once($_SERVER['DOCUMENT_ROOT'].'/db_connect.php'); // If submit button is pressed if(isset($_POST['submit'])) { if(!$_POST['email']) die("Error: You must enter your email address before proceeding."); } // Verify User Account exists with email address $email = $_POST['email']; $check_user = mysql_query("SELECT * FROM `members` WHERE user_email = $email "); $q = mysql_fetch_object($check_user); if(!$q) die("Reset Failure: An error occured, please verify that your email address is correct."); // Random Generate Password and store plain text in variable // Email User's email address with plaintext password // MD5 password and insert it into the member database ?> And i'm getting the mysql fetch object not a valid resource error. So I started looking at the query and tried to echo the results of it and its coming up blank and clearly coming back null. I'm guessing its something to do with my syntax of the query. So what am i doing wrong and how do i avoid this next time Cheers from a total php/mysql loser Quote Link to comment https://forums.phpfreaks.com/topic/83701-solved-problem-with-query/ Share on other sites More sharing options...
aussiefly Posted December 30, 2007 Author Share Posted December 30, 2007 looks like i solved it by placing the variable $email inside ' ' So it was just a syntax error...but dang it took me a bit to get it lol. Thanks anyway...ill keep cracking away. cheers Quote Link to comment https://forums.phpfreaks.com/topic/83701-solved-problem-with-query/#findComment-425864 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.