Jump to content

[SOLVED] Problem with Query


aussiefly

Recommended Posts

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 :)

Link to comment
https://forums.phpfreaks.com/topic/83701-solved-problem-with-query/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.