Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.