My last question was answered so quickly and so well that I thought I'd put this one out there too. I'm not sure that I provided enough info, so if you need more, just let me know. The following code is taken from a form page that handles itself. The first conditional ckecks that the required fields have been filled out. The page has already connected to the database. When I run the script the first query doesn't work, and so $tid always equals 0. I tried putting it directly into MySql using phpMyAdmin with strings instead of variables, and it ran fine.
- Code: Select all
if ($sc && $t && $d) { // If everything has been filled out correctly.
// Add the record to the database.
$query = "INSERT INTO photo_titles (title, description, photo_date) VALUES ( $t, $c, $d )";
$result = @mysql_query ($query); // Run the query
$tid = @mysql_insert_id(); // Get the photo_title_pk
if ($tid > 0) { // If everything worked
// Creat a photos entry for each of the photos sub categories
Thanks for any help anyone can provide,
wastvedt