Jump to content

I am getting a blank page but expecting a success message


CyberShot

Recommended Posts

on my index page, I have a form with the action of formData.php which is this code

 


<?php include("includes/connection.php"); 
//opens the database connection
//connection.php
//function connect() {
//global $mysql;
//$mysql = new MySQLi('localhost','user','password','billPay') or die('couldn not connect'. mysql_error());
//}

connect();
if(isset($_POST['submit'])){
$firstName = $_POST['firstName'];
$lastName = $_POST['lastName'];
$companyName = $_POST['companyName'];
$homePhone = $_POST['homePhone'];
$cellPhone = $_POST['cellPhone'];
$companyPhone = $_POST['companyPhone'];
}

$insert = $mysql->query("INSERT INTO names('firstName','lastName','companyName'), phone('home','cell','company') values('$firstName','$lastName','$companyName','$homePhone','$cellPhone','$companyPhone'");
if($insert){
echo "success!";
}
else
{
mysql_error();
}

?>

 

when I push the insert button, it goes to the formData.php page like it should be instead of giving an error or a success message, it's blank.

I am not following you guys. This code works

 

$mysql = new MySQLi('localhost','user','password','billPay') or die('couldn not connect'. mysql_error())

 

notice that it is MySQLI and the use of mysql_error()

 

that is the only mysql_error I am using because it does give me an error. Where would I be mixing mysql extensions?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.