I don't know what I'm doing wrong but I receive this error:-
Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in C:\wamp\www\includes\config.php on line 7
How can I fix this?
<?php
$mysql_hostname = "localhost";
$mysql_user = "bootstrapadmin";
$mysql_password = "";
$mysql_database = "bootstrap";
$bd = mysql_connect($mysql_hostname, $mysql_user, $mysql_password) or die("Mate you fucked something up!");
mysql_select_db($mysql_database, $bd) or die("Mate you fucked something up!");
?>
Now I'm running into the problem with my login page
Warning: mysqli_query() expects at least 2 parameters, 1 given in C:\wamp\www\login.php on line 12
Call Stack
# Time Memory Function Location
1 0.0012 140512 {main}( ) ..\login.php:0
2 0.0079 149352 mysqli_query ( ) ..\login.php:12
( ! ) Warning: mysql_num_rows() expects parameter 1 to be resource, null given in C:\wamp\www\login.php on line 13
Call Stack
# Time Memory Function Location
1 0.0012 140512 {main}( ) ..\login.php:0
2 0.0960 149752 mysql_num_rows ( ) ..\login.php:13
<?php
session_start();
include("includes/config.php");
if ($_SERVER["REQUEST_METHOD"] == "POST") {
//username and password sent from form
$myusername = addslashes($_POST['username']);
$mypassword = md5(addslashes($_POST['password']));
$sql = "SELECT userid FROM tbl_users WHERE username='$myusername' and password='$mypassword'";
$result = mysqli_query($sql);
$count = mysql_num_rows($result);
// If result matched $myusername and $mypassword, table row must be 1 row
if ($count == 1) {
//$session_register("myusername");
$_SESSION['login_admin'] = $myusername;
header("location: http://localhost/admin/");
}
}
?>