Symbianize Forum

Most of our features and services are available only to members, so we encourage you to login or register a new account. Registration is free, fast and simple. You only need to provide a valid email. Being a member you'll gain access to all member forums and features, post a message to ask question or provide answer, and share or find resources related to mobile phones, tablets, computers, game consoles, and multimedia.

All that and more, so what are you waiting for, click the register button and join us now! Ito ang website na ginawa ng pinoy para sa pinoy!

Help naman po to my PHP Error...

ScreamAimsFire

Proficient
Advanced Member
Messages
228
Reaction score
13
Points
38
Help naman po nag eerror po kasi yung input code ko, eto po error nya

Error: INSERT INTO daily_data (date, main, spillinglvl, sldiff, orc, orcdiff, aveinflow, aya, masiway, idr, rf, avi ) VALUES ('2019-07-30', '7', '7', '7', '7', '7', '7', '4', '7', '5', '6', '7',)
You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ')' at line 2


create.php
Code:
<?php
	
	include ("db/connection.php");

	if ($conn->connect_error) {

		die ("Connection Failed" . $conn->connect_error);
	}

			$date = $_POST['date'];
			$main = $_POST['main'];
			$spillinglvl = $_POST['spillinglvl'];
			$sldiff = $_POST['sldiff'];
			$orc = $_POST['orc'];
			$orcdiff = $_POST['orcdiff'];
			$aveinflow	 = $_POST['aveinflow'];
			$aya = $_POST['aya'];
			$masiway = $_POST['masiway'];
			$idr = $_POST['idr'];
			$rf = $_POST['rf'];
			$avi = $_POST['avi'];
			

	$sql = "INSERT INTO daily_data (date, main, spillinglvl, sldiff, orc, orcdiff, aveinflow, aya, masiway, idr, rf, avi ) VALUES 
	('$date', '$main', '$spillinglvl', '$sldiff', '$orc', '$orcdiff', '$aveinflow', '$aya', '$masiway', '$idr', '$rf', '$avi',)"
	or die (mysql_error());

	if ($conn->query($sql) === TRUE) {

		header("Location:index.php");

	}

	else

	{

		echo "Error: " . $sql . "<br>" . $conn->error;
	}

	$conn->close();

?>
 
('2019-07-30', '7', '7', '7', '7', '7', '7', '4', '7', '5', '6', '7',)

sobra ka ng comma. tangalin mo comma after nung last digit na 7.
 
$sql = "INSERT INTO daily_data (date, main, spillinglvl, sldiff, orc, orcdiff, aveinflow, aya, masiway, idr, rf, avi ) VALUES
('$date', '$main', '$spillinglvl', '$sldiff', '$orc', '$orcdiff', '$aveinflow', '$aya', '$masiway', '$idr', '$rf', '$avi')"
or die (mysql_error());
 
Back
Top Bottom