lauren_etherington Posted January 20, 2014 Share Posted January 20, 2014 Sooo, I could use some help. The code is needed to populate a database from the form, unfortunately, it is not populating the database. When I click submit, a white page appears <?php $a = $_POST['auth']; $t = $_POST['tit']; $st = $_POST['stat']; $sn = $_POST['short']; $c = $_POST['art']; $conn = mysqli_connect(""); if(!is_uploaded_file($_FILES['file']['tmp_name'])) { $query = "INSERT INTO newsitem (author,title,shortdesc,article,newsdate,status) VALUES ('$a','$t','$sn','$c',CURDATE(),'$st')"; } else { if ($_FILES['file']['type'] != "image/gif" && $_FILES['file']['type'] != "image/jpeg" && $_FILES['file']['type'] != "image/jpg" && $_FILES['file']['type'] != "image/x-png" && $_FILES['file']['type'] != "image/png") { $query = "INSERT INTO newsitem (author,title,shortdesc,article,newsdate,status) VALUES ('$a','$t','$sn','$c',CURDATE(),'$st')"; } else { $finame = $_FILES["file"]["name"]; $result = move_uploaded_file($_FILES['file']['tmp_name'], "../news/$finame"); if ($result == 1) { $query = "INSERT INTO newsitem (author,title,shortdesc,article,newsdate,status) VALUES ('$a','$t','$sn','$c',CURDATE(),'$st','$finame')"; } else { $query = "INSERT INTO newsitem (author,title,shortdesc,article,newsdate,status) VALUES ('$a','$t','$sn','$c',CURDATE(),'$st')"; } } } $conn->close(); ?> I cannot for the life of me see what it wrong with it, When I run the debugger it cuts off at conn with the Call to undefined function mysqli_connect() error message. If anyone could help point me in the right direction that would be great Quote Link to comment Share on other sites More sharing options...
requinix Posted January 20, 2014 Share Posted January 20, 2014 Find your php.ini and set error_reporting = -1 display_errors = onThen restart your web server and run your script. Do you still get that error message? (I'm sure you will.) The message means you don't have the mysqli extension enabled. Are you sure that's what you're supposed to be using? Maybe you're using the mysql_* functions or PDO in the rest of your code? Quote Link to comment Share on other sites More sharing options...
Ch0cu3r Posted January 20, 2014 Share Posted January 20, 2014 It is not populating the database. Your code only defines some queries but never executes them. When I click submit, a white page appears What are you expecting to see? Your do not seem be sending any output. Quote Link to comment Share on other sites More sharing options...
Solution lauren_etherington Posted January 22, 2014 Author Solution Share Posted January 22, 2014 I've managed to fix this error but thanks guys! Quote Link to comment 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.