Question: take the form and loop through an array to save all values in the form. code: query ( $sql ) ; $database - > bind

take the form and loop through an array to save all values in the form.
code:
query($sql);
$database->bind(":id", $id);
$database->execute();
$rows = $database->object();
foreach($rows as $key=>$val){echo $val ."
";}
//for loop for the form
/*
echo "saved. please make sure that the informztion is correct.
";
echo "$id
";
echo "$JobNumber
";
echo "$MatDesc
";
echo "$Contact
" ;
echo "$ContactNo
" ;
echo "$MatListLoc
" ;
echo "$Driver
" ;
echo "$jobStatus
" ;*/
/* THIS PART WORKS
//foreach row to be saved, if there is a :
$database= new database();
$sql="UPDATE jobmat.details SET id=:id,
JobNumber=:JobNumber,
jobName=:jobName,
jobAddress=:jobAddress,
MatDesc=:MatDesc,
Contact=:Contact,
ContactNo=:ContactNo,
MatListLoc=:MatListLoc,
Driver=:Driver,
jobStatus=:jobStatus
where id=:id";
$database->query($sql);
$database->bind(":id",$id);
$database->bind(":JobNumber",$JobNumber);
$database->bind(":jobName",$jobName);
$database->bind(":jobAddress",$jobAddress);
$database->bind(":MatDesc",$MatDesc);
$database->bind(":Contact",$Contact);
$database->bind(":ContactNo",$ContactNo);
$database->bind(":MatListLoc",$MatListLoc);
$database->bind(":Driver",$Driver);
$database->bind(":jobStatus",$jobStatus);
$database->execute();
*/
echo "not correct?Go back to the form
";
echo "Main Page";
?>
 take the form and loop through an array to save all

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!