Hi,
Just when you thought I had gone. For the last 40 mins I have been trying to find the answer to this issue. This time I will post my code as it is now and the errors below that:
<?php
session_start();
$self = $_SERVER['PHP_SELF'];
$localhost = 'localhost';
$dbuser = 'root';
$dbpass = 'password';
$dbname = 'north';
$mysqli = new mysqli($localhost, $dbuser, $dbpass, $dbname);
if ($mysqli->connect_errno) {
echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
}
//select_db($dbname, $connect);
if(isset($_POST['submit']))
{
var_dump($_POST);
$id = mysqli_real_escape_string($_POST['id']);
$title = mysqli_real_escape_string($_POST['title']);
$description = mysqli_real_escape_string($_POST['description']);
$keywords = mysqli_real_escape_string($_POST['keywords']);
$_SESSION['id']=$id;
$_SESSION['title']=$title;
$_SESSION['description']=$description;
$_SESSION['keywords']=$keywords;
$query = "INSERT INTO URL VALUES ('','$id','$title','$description','$keywords')";
mysqli_query($query);
$success = 'You have successfully updated your data';
}
$form ="<div style=\"width:400px;\">";
$form.="<p>Database result:";
if(isset($success)) {
$form .= $success;
}
$form.= "</p>";
$form.="<form action=\"$self\" method=\"post\" id=\"contactus\">";
$form.="<fieldset>";
$form.="<span>Page Name:</span> <label><input type=\"text\" name=\"id\"></label><br>\n";
$form.="<span>Title:</span> <label><input type=\"text\" name=\"title\"></label><br>\n";
$form.="<span>Description:</span> <label><input type=\"text\" name=\"description\"></label><br>\n";
$form.="<span>Keywords:</span> <label><input type=\"text\" name=\"keywords\"></label><br>\n";
$form.="<input type=\"submit\" name=\"submit\">\n";
$form.="</fieldset>";
$form.="</form>";
$form.="</div>";
print $form;
?>
Errors:
Warning: mysqli_real_escape_string() expects exactly 2 parameters, 1 given in /var/www/test/index.php on line 50
Warning: mysqli_real_escape_string() expects exactly 2 parameters, 1 given in /var/www/test/index.php on line 51
Warning: mysqli_real_escape_string() expects exactly 2 parameters, 1 given in /var/www/test/index.php on line 52
Warning: mysqli_real_escape_string() expects exactly 2 parameters, 1 given in /var/www/test/index.php on line 53
Warning: mysqli_query() expects at least 2 parameters, 1 given in /var/www/test/index.php on line 60