Jump to content

White Screen Trouble


lauren_etherington
Go to solution Solved by lauren_etherington,

Recommended Posts

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 :)

Link to comment
Share on other sites

Find your php.ini and set

error_reporting = -1
display_errors = on
Then 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?

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.