forked from science-ation/science-ation
Wehn adding a project, get the WHOLE project object to return using getProject instead of simply quering it manually
This commit is contained in:
parent
0255fdbb88
commit
81f6702412
@ -527,18 +527,24 @@ function saveRegistrationData($d) {
|
|||||||
return getRegistration($data['id']);
|
return getRegistration($data['id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getProject($userId){
|
function getProject($userId,$registrations_id=null){
|
||||||
global $conference;
|
global $conference;
|
||||||
|
|
||||||
$userId = intval($userId);
|
if($registrations_id) {
|
||||||
$result = mysql_fetch_assoc(mysql_query("SELECT registrations_id FROM users WHERE id='$userId'"));
|
$regId=$registrations_id;
|
||||||
if(!is_array($result)){
|
|
||||||
return "register_participants.inc.php::getProject -> User not found";
|
|
||||||
}
|
}
|
||||||
$regId = $result['registrations_id'];
|
else {
|
||||||
if(!$regId) {
|
$userId = intval($userId);
|
||||||
return "register_participants.inc.php::getProject -> no registration id";
|
$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
|
// FIXME - in the future, this should be able to handle a many-to-many
|
||||||
// relationship in projects to registrations (so remove that LIMIT 1)
|
// relationship in projects to registrations (so remove that LIMIT 1)
|
||||||
$fields = implode(',', array(
|
$fields = implode(',', array(
|
||||||
@ -592,12 +598,7 @@ function addProject($registrations_id){
|
|||||||
VALUES ('" . $registrations_id . "','" . $conference['id']."', '$projCategory')
|
VALUES ('" . $registrations_id . "','" . $conference['id']."', '$projCategory')
|
||||||
");
|
");
|
||||||
//now query the one we just inserted
|
//now query the one we just inserted
|
||||||
$q = mysql_query("SELECT * FROM projects WHERE registrations_id='$registrations_id' AND conferences_id='{$conference['id']}'");
|
$returnval=getProject(null,$registrations_id);
|
||||||
if(mysql_error()) {
|
|
||||||
$returnval = "register_participants.inc.php::addProject -> " . mysql_error();
|
|
||||||
}else{
|
|
||||||
$returnval = mysql_fetch_assoc($q);
|
|
||||||
}
|
|
||||||
return $returnval;
|
return $returnval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user