Jump to content

[SOLVED] Simple MySQL Query error


me1000

Recommended Posts

Howdy,

 

Working on developing a simple login script

but Im getting an error...

after about a half an hour of debugging this very simple script

I have narrowed it down the the query

 

here is the code...

Maybe fresh eyes can find it.

 

// Connect to server and select databse.
mysql_connect("$host", "$username", "$password")or die("cannot connect"); 
mysql_select_db("$db_name")or die("cannot select DB");




// username and password sent from form 
$myusername=$_POST['myusername2']; 
$mypassword=$_POST['mypassword2']; 



// encrypt password
$encrypted_mypassword=md5($mypassword);

$sql= "INSERT INTO $tbl_name (username, password) VALUES ('$myusername','$encrypted_mypassword'";
$result=mysql_query($sql);

$response = ($result) ? "Record Added" : "Error adding record!";

echo $response ;

 

 

Thank You,

Me1000

Link to comment
https://forums.phpfreaks.com/topic/43182-solved-simple-mysql-query-error/
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.