Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Only process the form if $_POST isn't empty
- if ( ! empty( $_POST ) ) {
- // Connect to MySQL
- $mysqli = new mysqli( 'localhost', 'numebazadate', 'parola', 'numeutilizator' );
- // Check our connection
- if ( $mysqli->connect_error ) {
- die( 'Connect Error: ' . $mysqli->connect_errno . ': ' . $mysqli->connect_error );
- }
- // Insert our data
- $sql = "INSERT INTO pages ( title, slug, pagetext ) VALUES ( '{$mysqli->real_escape_string($_POST['title'])}', '{$mysqli->real_escape_string($_POST['slug'])}', '{$mysqli->real_escape_string($_POST['pagetext'])}' )";
- $insert = $mysqli->query($sql);
- // Print response from MySQL
- if ( $insert ) {
- $message = "<h3>Page added! Row ID: {$mysqli->insert_id}</h3>";
- } else {
- die("Error: {$mysqli->errno} : {$mysqli->error}");
- }
- // Close our connection
- $mysqli->close();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement