Quantcast
Channel: PHP Freaks: PHP Help
Viewing all articles
Browse latest Browse all 13200

White Screen Trouble

$
0
0

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


Viewing all articles
Browse latest Browse all 13200

Trending Articles