note 114249 deleted from function.gethostbyname by peehaa
| From: | peehaa@php.net | Date: | Tue, 10 Feb 2015 17:01:32 +0000 |
| Subject: | note 114249 deleted from function.gethostbyname by peehaa | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-201690@lists.php.net to get a copy of this message | ||
Note Submitter: filippusnafuka at gmail dot com
----
<?php
$mysql_hostname = "localhost";
$mysql_username="root";
$mysql_password="emma"; // if it is exist in your database other wise it will be
null($password="")
$mysql_database="try";
//connects to database
$db = mysql_connect($mysql_hostname, $mysql_username, $mysql_password)
or die("ther is an error in connecting with the database");
mysql_select_db('try') or die("couldn't find database");
$username = @$_POST['username'];
$password = @$_POST['password'];
$submit = @$_POST['submit'];
$encpassword = md5($password);
if($submit){
if($username==true){
if($password==true){
mysql_select_db('try');
$db = new mysqli($mysql_hostname,$mysql_username,$mysql_password,$mysql_database);
//to show encrypted pass use encpassword
mysql_query("INSERT INTO table1 (id, username, password) values
('$_POST[username]','$_POST[password]')");
// echo ("Last inserted record has id %d\n", mysql_insert_id());
header("Location: localhost\new.php"); /* Redirect browser */
/* Make sure that code below does not get executed when we redirect. */
exit;
//38
}else{
echo ("Please enter password: ");
}
}
}//end of iF submit
?>
What is wrong with this code? .it does not want to post to the database