darrin365 Posted January 12, 2007 Share Posted January 12, 2007 Hmmm..I've got an error in here somewhere and I cannot find it despite hours of review. Also, in line 45 is some code I picked up from somewhere else on how to pull the newly generated key_id from one table and immediately insert it into other tables. It calls for inserting NULL into the field, but it dawns on me that it's the primary key field and it's set for NOT NULL. That won't work, will it?[code]<?php// get the parameters passed$task = trim( mosGetParam( $_REQUEST, 'task', '' ) );// determine what to doswitch ($task) { case "check": // if user is not logged in loggedin(); break; case "savelisting": // save the listing savelisting( $option ); break; } function loggedin() { if ( $my->id > 0 ) { $query = "LOCK TABLES dtd_trips WRITE, dtd_user2trip WRITE, dtd_link2trip WRITE"; $database->setQuery($query); echo "Tables locked"; $name_query = "INSERT INTO dtd_trips (trip_id, trip_name) VALUES (NULL, $_POST[trip_name])"; $intersect_query = "INSERT INTO dtd_trip2user (user_id, trip_id) VALUES ($my->id, LAST_INSERT_ID())"; $n_query = mysql_query($name_query); $i_query = mysql_query($intersect_query); $query = "UNLOCK TABLES"; $database->setQuery($query); } else { die("You must be logged in to create a trip."); } HTML_tripmaker::show_form();?>[/code]Keep in mind the form is in another file and is inside of the show_form function.The site is returning this error:Parse error: parse error, unexpected $ in /xxx/xxx/components/com_tripmaker/tripmaker.php on line 57I hope that's enough data.Thanks for your time. Link to comment https://forums.phpfreaks.com/topic/33957-can-you-spot-the-error/ Share on other sites More sharing options...
play_ Posted January 12, 2007 Share Posted January 12, 2007 [code]// get the parameters passed$task = trim( mosGetParam( $_REQUEST, 'task', '' ) );// determine what to doswitch ($task) { case "check": // if user is not logged in loggedin(); break; case "savelisting": // save the listing savelisting( $option ); break; } function loggedin() { if ( $my->id > 0 ) { $query = "LOCK TABLES dtd_trips WRITE, dtd_user2trip WRITE, dtd_link2trip WRITE"; $database->setQuery($query); echo "Tables locked"; $name_query = "INSERT INTO dtd_trips (trip_id, trip_name) VALUES (NULL, $_POST[trip_name])"; $intersect_query = "INSERT INTO dtd_trip2user (user_id, trip_id) VALUES ($my->id, LAST_INSERT_ID())"; $n_query = mysql_query($name_query); $i_query = mysql_query($intersect_query); $query = "UNLOCK TABLES"; $database->setQuery($query); } else { die("You must be logged in to create a trip."); } } HTML_tripmaker::show_form();[/code] Link to comment https://forums.phpfreaks.com/topic/33957-can-you-spot-the-error/#findComment-159463 Share on other sites More sharing options...
darrin365 Posted January 12, 2007 Author Share Posted January 12, 2007 Thanks, play! I was just coming back to say I finally spotted where the } was missing. I appreciate the help! Link to comment https://forums.phpfreaks.com/topic/33957-can-you-spot-the-error/#findComment-159482 Share on other sites More sharing options...
darrin365 Posted January 12, 2007 Author Share Posted January 12, 2007 Alright, I've looked everywhere and I can't find how to mark this puppy solved. Link to comment https://forums.phpfreaks.com/topic/33957-can-you-spot-the-error/#findComment-159500 Share on other sites More sharing options...
Jessica Posted January 12, 2007 Share Posted January 12, 2007 The solved button got removed in an update, apparently :/ Link to comment https://forums.phpfreaks.com/topic/33957-can-you-spot-the-error/#findComment-159504 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.