Wehn adding a project, get the WHOLE project object to return using getProject instead of simply quering it manually

This commit is contained in:
james 2011-03-04 04:54:50 +00:00
parent 0255fdbb88
commit 81f6702412

View File

@ -527,9 +527,13 @@ function saveRegistrationData($d) {
return getRegistration($data['id']);
}
function getProject($userId){
function getProject($userId,$registrations_id=null){
global $conference;
if($registrations_id) {
$regId=$registrations_id;
}
else {
$userId = intval($userId);
$result = mysql_fetch_assoc(mysql_query("SELECT registrations_id FROM users WHERE id='$userId'"));
if(!is_array($result)){
@ -539,6 +543,8 @@ function getProject($userId){
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;
}