Hi guys i can't seem to figure out whats wrong with my sql statement. its an insert statements using session variables to insert into a SQLite table.

part of problem code as follows:

<?php 

  
 
$db = new PDO('sqlite:name.sqlite');
 


$submitNewSummary =  $db ->query("INSERT INTO clinicalSummary(placementID,attMon1,attTue1,attWed1,attThu1,attFri1,attMon2,attTue2,attWed2,attThu2,attFri2,item1,item2,item3,item4,item5,item6,item7,item8,item9,item10,item11,item12,item13,item14,item15,item16,item17,item18,item19,item20,dateCompleted)
VALUES (".$_SESSION['studentRetrievedPID'].",".$_SESSION['Monday1'].",".$_SESSION['Tuesday1'].",".$_SESSION['Wednesday1'].",".$_SESSION['Thursday1'].",".$_SESSION['Friday1'].",".$_SESSION['Monday2'].",".$_SESSION['Tuesday2'].",".$_SESSION['Wednesday2'].",".$_SESSION['Thursday2'].",".$_SESSION['Friday2'].",".$_SESSION['itemSummary1'].",".$_SESSION['itemSummary2'].",".$_SESSION['itemSummary3'].",".$_SESSION['itemSummary4'].",".$_SESSION['itemSummary5'].",".$_SESSION['itemSummary6'].",".$_SESSION['itemSummary7'].",".$_SESSION['itemSummary8'].",".$_SESSION['itemSummary9'].",".$_SESSION['itemSummary10'].",".$_SESSION['itemSummary11'].",".$_SESSION['itemSummary12'].",".$_SESSION['itemSummary13'].",".$_SESSION['itemSummary14'].",".$_SESSION['itemSummary15'].",".$_SESSION['itemSummary16'].",".$_SESSION['itemSummary17'].",".$_SESSION['itemSummary18'].",".$_SESSION['itemSummary19'].",".$_SESSION['itemSummary20'].",".$_SESSION['studentRetrievedDF'].")");
if ($submitNewSummary)

{
echo "New Summary Successfully added";
}
else
{
echo "Adding New Summary failed!";

}

?>

Are ALL of those db fields NUMERIC data types?
If you are inserting text, you need apostrophes around the value. If you are inserting a NUMBER then do not put apostrophes around the value - ex:

INSERT INTO Person(email,age) VALUES('john@company.com',23)
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.