Add better debug messages to output

This commit is contained in:
james 2011-03-03 23:14:52 +00:00
parent 4c15b72a8b
commit c87f23397f
2 changed files with 10 additions and 9 deletions

View File

@ -378,9 +378,9 @@ switch($request[0]) {
$p = getProject($u['id']); $p = getProject($u['id']);
if(is_array($p)) { if(is_array($p)) {
$_SESSION['registration_id'] = $p['registrations_id']; $_SESSION['registration_id'] = $p['registrations_id'];
$_SESSION['registration_number'] = $p['num']; $_SESSION['registration_number'] = $p['registration_number'];
}else }else
$_SESSION['error'] = "project not found"; $_SESSION['error'] = "project not found: $p";
} }
else{ else{

View File

@ -285,9 +285,8 @@ function saveProjectData($data,$registrations_id=null){
*/ */
}else{ }else{
//first, lets make sure this project really does belong to them //first, lets make sure this project really does belong to them
$qstr="SELECT * FROM projects WHERE id='" . $data['project_id'] . "' AND registrations_id='" . $rid . "' AND conferences_id='" . $conference['id'] . "'"; $qstr="SELECT * FROM projects WHERE id='" . $data['project_id'] . "' AND registrations_id='" . $rid . "' AND conferences_id='" . $conference['id'] . "'";
$q = mysql_query("SELECT * FROM projects WHERE id='" . $data['project_id'] . "' AND registrations_id='" . $rid . "' AND conferences_id='" . $conference['id'] . "'"); $q = mysql_query($qstr);
if(mysql_num_rows($q) == 1) { if(mysql_num_rows($q) == 1) {
$summarywords = preg_split("/[\s,]+/", $data['summary']); $summarywords = preg_split("/[\s,]+/", $data['summary']);
$summarywordcount = count($summarywords); $summarywordcount = count($summarywords);
@ -380,7 +379,7 @@ function saveProjectData($data,$registrations_id=null){
} }
} }
else { else {
$message = i18n("Invalid project to update"); $message = i18n("Invalid project to update: %1",array($qstr));
} }
} }
return $message; return $message;
@ -518,8 +517,8 @@ function saveRegistrationData($d) {
function getProject($userId){ function getProject($userId){
global $conference; global $conference;
$userid = intval($userId); $userId = intval($userId);
$result = mysql_fetch_assoc(mysql_query("SELECT registrations_id FROM users WHERE id = $userId")); $result = mysql_fetch_assoc(mysql_query("SELECT registrations_id FROM users WHERE id='$userId'"));
if(!is_array($result)){ if(!is_array($result)){
return "register_participants.inc.php::getProject -> User not found"; return "register_participants.inc.php::getProject -> User not found";
} }
@ -541,9 +540,11 @@ function getProject($userId){
)); ));
$q = mysql_query("SELECT $fields FROM projects $q = mysql_query("SELECT $fields FROM projects
JOIN registrations ON registrations.id = projects.registrations_id JOIN registrations ON registrations.id = projects.registrations_id
WHERE projects.registrations_id='$regId' AND projects.conferences_id='".$conference['id']."' LIMIT 1"); WHERE projects.registrations_id='$regId'
AND projects.conferences_id='".$conference['id']."'
LIMIT 1");
if(mysql_error()) { if(mysql_error()) {
$returnval = "register_participants.inc.php::getProject -> " . $returnval; return "register_participants.inc.php::getProject -> " . $mysql_error();
}else{ }else{
$returnval = mysql_fetch_assoc($q); $returnval = mysql_fetch_assoc($q);
} }