<?php |
//opens connnection to mysql server |
$dbc = mysql_connect( 'localhost' , 'root' , '' ); |
if (!dbc){ |
die ( 'Not Connected:' . mysql_error()); |
} |
//select a database |
$db_selected = mysql_select_db( "rivals" , $dbc ); |
if (! $db_selected ) |
{ |
die ( "can't connect :" . mysql_error()); |
} |
$query = "UPDATE `database` SET email='something' WHERE username='rivals'" ; |
$result = mysql_query( $query , $dbc ) or die (mysql_error()); |
$username = $_GET [ 'username' ]; |
$email = $_GET [ 'email' ]; |
$password = $_GET [ 'password' ]; |
$insert = "INSERT INTO `database` (`username`, `email`, `password`) VALUES ('$username', '$email', '$password')" ; |
if (isset( $username ) && isset( $email ) && isset( $password )){ |
$addnew = mysql_query( $insert , $dbc ) or die (mysql_error()); |
} |
if ( $addnew ){ |
echo "Username [" . $username . "] with Email Address [" . $email . "] and password[" . $password . "]<br><br>" ; |
} |
// just a message |
echo "it's done" |
?> |