when I tried to test my regeneration form this massage show up : "The mysql extension is deprecated and will be removed in the future: use mysqli or PDO"
I tried to change my code each time I got a new problem, I'm not so expert in these stuff can any one help me and tell me what exactly I need to change in my code please?!
connection code
<?php
# FileName="Connection_php_mysql.htm"
# Type="MYSQL"
# HTTP="true"
$hostname_localhost = "localhost";
$database_localhost = "rsms database";
$username_localhost = "root";
$password_localhost = "";
$localhost = mysql_pconnect($hostname_localhost, $username_localhost, $password_localhost) or trigger_error(mysql_error(),E_USER_ERROR);
?>
and this is my source code
<?php require_once('Connections/localhost.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form")) {
$insertSQL = sprintf("INSERT INTO users (email, DateOfBirth) VALUES (%s, %s)",
GetSQLValueString($_POST['email'], "text"),
GetSQLValueString($_POST['DateOfBirth'], "date"));
mysql_select_db($database_localhost, $localhost);
$Result1 = mysql_query($insertSQL, $localhost) or die(mysql_error());
$insertGoTo = "PageAfterLogin.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
mysql_select_db($database_localhost, $localhost);
$query_RegesterUsers = "SELECT * FROM users";
$RegesterUsers = mysql_query($query_RegesterUsers, $localhost) or die(mysql_error());
$row_RegesterUsers = mysql_fetch_assoc($RegesterUsers);
$totalRows_RegesterUsers = mysql_num_rows($RegesterUsers);
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
</head>
<body>
<div class="containerDiv" id="containerDiv">
Regesteration Page
<form method="POST" action="<?php echo $editFormAction; ?>" name="form">
<table width="600" border="0">
<tbody>
<tr>
<td><label for="email">Email:</label>
<input type="email" name="email" id="email"></td>
<td><label for="date">Date:</label>
<input type="date" name="DateOfBirth" id="DateOfBirth"></td>
</tr>
<tr>
<td> </td>
<td><input type="submit" name="submit" id="submit" value="Submit"></td>
</tr>
</tbody>
</table>
<input type="hidden" name="MM_insert" value="form">
</form>
</div>
</body>
</html>
<?php
mysql_free_result($RegesterUsers);
?>