Jump to content

MySQL Database Lookup


ged415

Recommended Posts

I am working with MySQL and a PHP script to lookup a user ID and password from a database. I can not however get it to return any results. it just says no such email. I can though see the database and the email address is there.

 

If I change the connection parameters I do get an error so it seems I am connecting. The database only has the three fields. Here is the code if someone see's my mistake any help would be greatly appreciated, thanks.

 

<?php

@mysql_connect("localhost", "login", "password!") or die("Cannot connect to DB!");

@mysql_select_db("database") or die("Cannot select DB!");

$query="SELECT email_webuser, id_webuser, passwd_webuser FROM b2bpasswords WHERE email_webuser=''".$email_webuser."''";

$r = mysql_query($query);

if(!$r) {

$err=mysql_error();

print $err;

exit();

}

if(mysql_affected_rows()==0){

print "no such email in the system. please try again.";

exit();

}

Link to comment
https://forums.phpfreaks.com/topic/148594-mysql-database-lookup/
Share on other sites

This is coming fom an HTML form that has one field, emial_webuser, with a POST action against forgot.php

 

I modified two lines to now be

 

$query="SELECT email_webuser, id_webuser, passwd_webuser FROM b2bpasswords WHERE email_webuser='".$email_webuser."'";

$r = mysql_query($query) or die(mysql_error());

 

I still get no such email in the system. please try again.

 

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.