CyberShot Posted December 13, 2010 Share Posted December 13, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/221489-i-am-getting-a-blank-page-but-expecting-a-success-message/ Share on other sites More sharing options...
n3r0x Posted December 13, 2010 Share Posted December 13, 2010 You´re using mysql_error which isn´t available in mysqli you should use $mysql->error check http://www.php.net/manual/en/mysqli.error.php for more information Quote Link to comment https://forums.phpfreaks.com/topic/221489-i-am-getting-a-blank-page-but-expecting-a-success-message/#findComment-1146553 Share on other sites More sharing options...
CyberShot Posted December 13, 2010 Author Share Posted December 13, 2010 it works in other areas of my code. Already tested. that is why I was using it there. When I try using mysql->error, I get a parse error Quote Link to comment https://forums.phpfreaks.com/topic/221489-i-am-getting-a-blank-page-but-expecting-a-success-message/#findComment-1146555 Share on other sites More sharing options...
trq Posted December 13, 2010 Share Posted December 13, 2010 it works in other areas of my code. Already tested. that is why I was using it there. When I try using mysql->error, I get a parse error You cannot mix and match two different mysql* extensions. Quote Link to comment https://forums.phpfreaks.com/topic/221489-i-am-getting-a-blank-page-but-expecting-a-success-message/#findComment-1146560 Share on other sites More sharing options...
CyberShot Posted December 13, 2010 Author Share Posted December 13, 2010 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? Quote Link to comment https://forums.phpfreaks.com/topic/221489-i-am-getting-a-blank-page-but-expecting-a-success-message/#findComment-1146763 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.