diff --git a/register_participants.inc.php b/register_participants.inc.php index 598cfff..af9b546 100644 --- a/register_participants.inc.php +++ b/register_participants.inc.php @@ -527,18 +527,24 @@ function saveRegistrationData($d) { return getRegistration($data['id']); } -function getProject($userId){ +function getProject($userId,$registrations_id=null){ global $conference; - $userId = intval($userId); - $result = mysql_fetch_assoc(mysql_query("SELECT registrations_id FROM users WHERE id='$userId'")); - if(!is_array($result)){ - return "register_participants.inc.php::getProject -> User not found"; + if($registrations_id) { + $regId=$registrations_id; } - $regId = $result['registrations_id']; - if(!$regId) { - return "register_participants.inc.php::getProject -> no registration id"; + else { + $userId = intval($userId); + $result = mysql_fetch_assoc(mysql_query("SELECT registrations_id FROM users WHERE id='$userId'")); + if(!is_array($result)){ + return "register_participants.inc.php::getProject -> User not found"; + } + $regId = $result['registrations_id']; + if(!$regId) { + return "register_participants.inc.php::getProject -> no registration id"; + } } + // FIXME - in the future, this should be able to handle a many-to-many // relationship in projects to registrations (so remove that LIMIT 1) $fields = implode(',', array( @@ -592,12 +598,7 @@ function addProject($registrations_id){ VALUES ('" . $registrations_id . "','" . $conference['id']."', '$projCategory') "); //now query the one we just inserted - $q = mysql_query("SELECT * FROM projects WHERE registrations_id='$registrations_id' AND conferences_id='{$conference['id']}'"); - if(mysql_error()) { - $returnval = "register_participants.inc.php::addProject -> " . mysql_error(); - }else{ - $returnval = mysql_fetch_assoc($q); - } + $returnval=getProject(null,$registrations_id); return $returnval; }