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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.