Two questions:
First, this syntax works:
$sql2 = "INSERT INTO selfAdvocateConventionInfo SET attendeeID=$foreignAttendeeID, photoFileName='".$_FILES['photoFileName']['name']."', photoFileSize='$photoFileSize', photoFileType='$photoFileType'";
This doesn't:
$sql2 = "INSERT INTO selfAdvocateConventionInfo
(attendeeID, photoFileSize, photoFileType, photoFileName)
VALUES ('$foreignAttendeeID', '$photoFileSize', '$photoFileType', " . $_FILES['photoFileName']['name'] . ")";
How come? I know the second syntax is preferred, but I can't get it to work.
Second question:
I have a form where you click one button and a photo uploads so the person can see if it's what they want. If they hit ok, then all the other fields are supposed to populate. My first round of SQL statements works, the update round doesn't. What am I doing wrong?
Here's the first series of statements that work:
$db = new MySQL(DBHOST,DBUSER,DBPASS,DBNAME);
$sql = "INSERT INTO attendees
(conventionID, typeOfAttendeeID, groupID)
VALUES ('2', '4', " . $_SESSION['foreignGroupID'] . ")";
$result = $db->query($sql);
$foreignAttendeeID = mysql_insert_id();
$sql2 = "INSERT INTO selfAdvocateConventionInfo SET attendeeID=$foreignAttendeeID, photoFileName='".$_FILES['photoFileName']['name']."', photoFileSize='$photoFileSize', photoFileType='$photoFileType'";
$result2 = $db->query($sql2);
$sql3 = "SELECT * FROM selfAdvocateConventionInfo WHERE attendeeID=$foreignAttendeeID";
$result3 = $db->query($sql3);
$row = $result3->fetch();
Then when they click ok, here's the next series of statements (the ones that don't work):
$db = new MySQL(DBHOST,DBUSER,DBPASS,DBNAME);
$sql5 = "SELECT * FROM attendees";
$result5 = $db->query($sql5);
$sql5 = "UPDATE attendees SET
firstName = '$firstName',
lastName = '$lastName',
email = '$email',
WHERE attendeeID='$foreignAttendeeID'";
$sql6 = "UPDATE selfAdvocateConventionInfo SET birthday = '$birthday', ageOk = '$ageOk', attendedBefore = '$attendedBefore', famCell = '$famCell'
WHERE attendeeID='$foreignAttendeeID'";
$result5 = $db->query($sql5);
$result6 = $db->query($sql6);
Also, do I need to be renaming the sql and result variables for the second round? Like is it necessary to put $sql5, $result5, etc?