forked from science-ation/science-ation
Fixed the sql error on signature page. Used bind params to assign variables into the query. Did some other changes to other files as well, my bad. But the sql error is the big change.
This commit is contained in:
parent
10ab500ece
commit
ba6e7156cb
@ -208,6 +208,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
$q = $pdo->prepare("INSERT INTO award_prizes(award_awards_id,year) VALUES ('$aaid','$year');");
|
$q = $pdo->prepare("INSERT INTO award_prizes(award_awards_id,year) VALUES ('$aaid','$year');");
|
||||||
|
$q->execute();
|
||||||
$ret = array('id' => $pdo->lastInsertId() );
|
$ret = array('id' => $pdo->lastInsertId() );
|
||||||
echo json_encode($ret);
|
echo json_encode($ret);
|
||||||
exit;
|
exit;
|
||||||
@ -1050,7 +1051,7 @@ if(!$orderby) $orderby="order";
|
|||||||
|
|
||||||
$q->execute();
|
$q->execute();
|
||||||
|
|
||||||
show_do_errros_if_any($pdo);
|
show_do_erros_if_any($pdo);
|
||||||
print_r($q->rowCount());
|
print_r($q->rowCount());
|
||||||
if($q->rowCount())
|
if($q->rowCount())
|
||||||
{
|
{
|
||||||
|
@ -384,7 +384,7 @@ foreach($report_stock as $n=>$v) {
|
|||||||
VALUES $q");
|
VALUES $q");
|
||||||
|
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
echo $pdo->erroInfo();
|
show_pdo_errors_if_any($pdo);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -240,6 +240,7 @@ $(document).ready(function() {
|
|||||||
</script>
|
</script>
|
||||||
<?
|
<?
|
||||||
|
|
||||||
|
global $edit_mode;
|
||||||
/* Load all the users reports */
|
/* Load all the users reports */
|
||||||
$q = $pdo->prepare("SELECT reports_committee.*,reports.name
|
$q = $pdo->prepare("SELECT reports_committee.*,reports.name
|
||||||
FROM reports_committee
|
FROM reports_committee
|
||||||
|
@ -150,7 +150,7 @@ $q=$pdo->prepare("SELECT
|
|||||||
lastname,
|
lastname,
|
||||||
firstname");
|
firstname");
|
||||||
$q->execute();
|
$q->execute();
|
||||||
echo $pdo->errorInfo();
|
show_pdo_errors_if_any($pdo);
|
||||||
while($r=$q->fetch(PDO::FETCH_OBJ)) {
|
while($r=$q->fetch(PDO::FETCH_OBJ)) {
|
||||||
$u=user_load($r->id);
|
$u=user_load($r->id);
|
||||||
|
|
||||||
@ -198,13 +198,13 @@ while($r=$q->fetch(PDO::FETCH_OBJ)) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
foreach($times as $x=>$t) {
|
foreach($times as $x=>$t) {
|
||||||
if($sel[$x]==true) {
|
if(get_value_from_array($sel, $x)==true) {
|
||||||
$timedata[]="yes";
|
$timedata[]="yes";
|
||||||
} else {
|
} else {
|
||||||
$timedata[]="no";
|
$timedata[]="no";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$tmp=array(
|
$tmp=array(
|
||||||
$r->id,
|
$r->id,
|
||||||
$r->uid,
|
$r->uid,
|
||||||
@ -213,7 +213,7 @@ while($r=$q->fetch(PDO::FETCH_OBJ)) {
|
|||||||
$r->email,
|
$r->email,
|
||||||
$r->phonehome,
|
$r->phonehome,
|
||||||
$r->phonework,
|
$r->phonework,
|
||||||
$r->phoneworkext,
|
get_value_property_or_default($r, 'phoneworkext'),
|
||||||
$r->phonecell,
|
$r->phonecell,
|
||||||
$languages,
|
$languages,
|
||||||
$r->organization,
|
$r->organization,
|
||||||
@ -223,7 +223,7 @@ while($r=$q->fetch(PDO::FETCH_OBJ)) {
|
|||||||
$r->province,
|
$r->province,
|
||||||
$r->postalcode,
|
$r->postalcode,
|
||||||
$r->highest_psd,
|
$r->highest_psd,
|
||||||
$r->professional_quals,
|
get_value_property_or_default($r, 'professional_quals'),
|
||||||
$expertise_other
|
$expertise_other
|
||||||
);
|
);
|
||||||
$tmp = array_merge($tmp, $qarray);
|
$tmp = array_merge($tmp, $qarray);
|
||||||
|
@ -121,7 +121,7 @@ $q=$pdo->prepare("SELECT
|
|||||||
firstname,
|
firstname,
|
||||||
year");
|
year");
|
||||||
$q->execute();
|
$q->execute();
|
||||||
echo $pdo->errorInfo();
|
show_pdo_errors_if_any($pdo);
|
||||||
while($r=$q->fetch(PDO::FETCH_OBJ)) {
|
while($r=$q->fetch(PDO::FETCH_OBJ)) {
|
||||||
$u=user_load($r->id);
|
$u=user_load($r->id);
|
||||||
|
|
||||||
@ -163,7 +163,7 @@ while($r=$q->fetch(PDO::FETCH_OBJ)) {
|
|||||||
$r->email,
|
$r->email,
|
||||||
$r->phonehome,
|
$r->phonehome,
|
||||||
$r->phonework,
|
$r->phonework,
|
||||||
$r->phoneworkext,
|
get_value_property_or_default($r, 'phoneworkext'),
|
||||||
$r->phonecell,
|
$r->phonecell,
|
||||||
$languages,
|
$languages,
|
||||||
$r->organization,
|
$r->organization,
|
||||||
@ -173,7 +173,7 @@ while($r=$q->fetch(PDO::FETCH_OBJ)) {
|
|||||||
$r->province,
|
$r->province,
|
||||||
$r->postalcode,
|
$r->postalcode,
|
||||||
$r->highest_psd,
|
$r->highest_psd,
|
||||||
$r->professional_quals,
|
get_value_property_or_default($r, 'professional_quals'),
|
||||||
$expertise_other
|
$expertise_other
|
||||||
);
|
);
|
||||||
$tmp = array_merge($tmp, $qarray);
|
$tmp = array_merge($tmp, $qarray);
|
||||||
|
@ -70,7 +70,7 @@
|
|||||||
$rep->heading($team['name']." (".$team['num'].")");
|
$rep->heading($team['name']." (".$team['num'].")");
|
||||||
|
|
||||||
$memberlist="";
|
$memberlist="";
|
||||||
if(count($team['members']))
|
if(count(get_value_from_array($team,'members', [])))
|
||||||
{
|
{
|
||||||
foreach($team['members'] AS $member)
|
foreach($team['members'] AS $member)
|
||||||
{
|
{
|
||||||
@ -94,7 +94,7 @@
|
|||||||
//get category eligibility
|
//get category eligibility
|
||||||
$q=$pdo->prepare("SELECT projectcategories.category FROM projectcategories, award_awards_projectcategories WHERE award_awards_projectcategories.projectcategories_id=projectcategories.id AND award_awards_projectcategories.award_awards_id='{$award['id']}' AND award_awards_projectcategories.year='{$config['FAIRYEAR']}' AND projectcategories.year='{$config['FAIRYEAR']}' ORDER BY category");
|
$q=$pdo->prepare("SELECT projectcategories.category FROM projectcategories, award_awards_projectcategories WHERE award_awards_projectcategories.projectcategories_id=projectcategories.id AND award_awards_projectcategories.award_awards_id='{$award['id']}' AND award_awards_projectcategories.year='{$config['FAIRYEAR']}' AND projectcategories.year='{$config['FAIRYEAR']}' ORDER BY category");
|
||||||
$q->execute();
|
$q->execute();
|
||||||
echo $pdo->erroInfo();
|
show_pdo_errors_if_any($pdo);
|
||||||
$cats="";
|
$cats="";
|
||||||
while($r=$q->fetch(PDO::FETCH_OBJ))
|
while($r=$q->fetch(PDO::FETCH_OBJ))
|
||||||
{
|
{
|
||||||
@ -107,7 +107,7 @@
|
|||||||
//get division eligibility
|
//get division eligibility
|
||||||
$q=$pdo->prepare("SELECT projectdivisions.division_shortform FROM projectdivisions, award_awards_projectdivisions WHERE award_awards_projectdivisions.projectdivisions_id=projectdivisions.id AND award_awards_projectdivisions.award_awards_id='{$award['id']}' AND award_awards_projectdivisions.year='{$config['FAIRYEAR']}' AND projectdivisions.year='{$config['FAIRYEAR']}' ORDER BY division_shortform");
|
$q=$pdo->prepare("SELECT projectdivisions.division_shortform FROM projectdivisions, award_awards_projectdivisions WHERE award_awards_projectdivisions.projectdivisions_id=projectdivisions.id AND award_awards_projectdivisions.award_awards_id='{$award['id']}' AND award_awards_projectdivisions.year='{$config['FAIRYEAR']}' AND projectdivisions.year='{$config['FAIRYEAR']}' ORDER BY division_shortform");
|
||||||
$q->execute();
|
$q->execute();
|
||||||
echo $pdo->erroInfo();
|
show_pdo_errors_if_any($pdo);
|
||||||
$divs="";
|
$divs="";
|
||||||
while($r=$q->fetch(PDO::FETCH_OBJ))
|
while($r=$q->fetch(PDO::FETCH_OBJ))
|
||||||
{
|
{
|
||||||
|
@ -52,22 +52,22 @@ case 'addwinner':
|
|||||||
}
|
}
|
||||||
|
|
||||||
//first check how many we are allowed to have
|
//first check how many we are allowed to have
|
||||||
$q=pdo->prepare("SELECT number FROM award_prizes WHERE id='$prize_id'");
|
$q=$pdo->prepare("SELECT number FROM award_prizes WHERE id='$prize_id'");
|
||||||
$q->execute();
|
$q->execute();
|
||||||
echo $pdo->errorInfo();
|
show_pdo_errors_if_any($pdo);
|
||||||
$r=$q->fetch(PDO::FETCH_ASSOC);
|
$r=$q->fetch(PDO::FETCH_ASSOC);
|
||||||
$number=$r['number'];
|
$number=$r['number'];
|
||||||
|
|
||||||
/* Get the award info */
|
/* Get the award info */
|
||||||
$q = $pdo->prepare("SELECT * FROM award_awards WHERE id='$award_awards_id'");
|
$q = $pdo->prepare("SELECT * FROM award_awards WHERE id='$award_awards_id'");
|
||||||
$q->execute();
|
$q->execute();
|
||||||
echo $pdo->errorInfo();
|
show_pdo_errors_if_any($pdo);
|
||||||
$a=$q->fetch(PDO::FETCH_ASSOC);
|
$a=$q->fetch(PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
/* Get the project */
|
/* Get the project */
|
||||||
$q = $pdo->prepare("SELECT fairs_id FROM projects WHERE id='$projects_id'");
|
$q = $pdo->prepare("SELECT fairs_id FROM projects WHERE id='$projects_id'");
|
||||||
$q->execute();
|
$q->execute();
|
||||||
echo $pdo->errorInfo();
|
show_pdo_errors_if_any($pdo);
|
||||||
$p=$q->fetch(PDO::FETCH_ASSOC);
|
$p=$q->fetch(PDO::FETCH_ASSOC);
|
||||||
$fairs_id = $p['fairs_id'];
|
$fairs_id = $p['fairs_id'];
|
||||||
|
|
||||||
@ -86,14 +86,14 @@ case 'addwinner':
|
|||||||
projects.fairs_id='$fairs_id'
|
projects.fairs_id='$fairs_id'
|
||||||
awards_prizes_id='$prize_id'");
|
awards_prizes_id='$prize_id'");
|
||||||
$q->execute();
|
$q->execute();
|
||||||
echo $pdo->errorInfo();
|
show_pdo_errors_if_any($pdo);
|
||||||
$r=$q->fetch(PDO::FETCH_ASSOC);
|
$r=$q->fetch(PDO::FETCH_ASSOC);
|
||||||
$count=$r['count'];
|
$count=$r['count'];
|
||||||
} else {
|
} else {
|
||||||
/* Count is the total number assigned */
|
/* Count is the total number assigned */
|
||||||
$q=$pdo->prepare("SELECT COUNT(*) AS count FROM winners WHERE awards_prizes_id='$prize_id'");
|
$q=$pdo->prepare("SELECT COUNT(*) AS count FROM winners WHERE awards_prizes_id='$prize_id'");
|
||||||
$q->execute();
|
$q->execute();
|
||||||
echo $pdo->errorInfo();
|
show_pdo_errors_if_any($pdo);
|
||||||
$r=$q->fetch(PDO::FETCH_ASSOC);
|
$r=$q->fetch(PDO::FETCH_ASSOC);
|
||||||
$count=$r['count'];
|
$count=$r['count'];
|
||||||
}
|
}
|
||||||
@ -141,7 +141,7 @@ case 'award_load':
|
|||||||
");
|
");
|
||||||
$q->execute();
|
$q->execute();
|
||||||
|
|
||||||
echo $pdo->errorInfo();
|
show_pdo_errors_if_any($pdo);
|
||||||
|
|
||||||
if($q->rowCount() != 1) {
|
if($q->rowCount() != 1) {
|
||||||
echo i18n("Invalid award to load $award_awards_id");
|
echo i18n("Invalid award to load $award_awards_id");
|
||||||
@ -178,7 +178,7 @@ case 'edit_load':
|
|||||||
");
|
");
|
||||||
$q->execute();
|
$q->execute();
|
||||||
|
|
||||||
echo $pdo->errorInfo();
|
show_pdo_errors_if_any($pdo);
|
||||||
|
|
||||||
if($q->rowCount() != 1) {
|
if($q->rowCount() != 1) {
|
||||||
echo i18n("Invalid award to edit $award_awards_id");
|
echo i18n("Invalid award to edit $award_awards_id");
|
||||||
@ -418,9 +418,10 @@ $q = $pdo->prepare("SELECT
|
|||||||
AND award_awards.sponsors_id=sponsors.id
|
AND award_awards.sponsors_id=sponsors.id
|
||||||
$fair_where
|
$fair_where
|
||||||
ORDER BY awards_order");
|
ORDER BY awards_order");
|
||||||
|
$q->execute();
|
||||||
|
|
||||||
// FIXME
|
|
||||||
//echo $pdo->errorInfo();
|
show_pdo_errors_if_any($pdo);
|
||||||
|
|
||||||
if($q->rowCount() == 0) {
|
if($q->rowCount() == 0) {
|
||||||
echo i18n('No awards to display.');
|
echo i18n('No awards to display.');
|
||||||
@ -498,7 +499,7 @@ function print_award(&$r, $fairs_id, $editor=false, $editor_data=array())
|
|||||||
ORDER BY
|
ORDER BY
|
||||||
`order`");
|
`order`");
|
||||||
$q->execute();
|
$q->execute();
|
||||||
echo $pdo->errorInfo();
|
show_pdo_errors_if_any($pdo);
|
||||||
|
|
||||||
echo "<table width=\"100%\"><tr><td>";
|
echo "<table width=\"100%\"><tr><td>";
|
||||||
$has_winners = false;
|
$has_winners = false;
|
||||||
@ -532,7 +533,7 @@ function print_award(&$r, $fairs_id, $editor=false, $editor_data=array())
|
|||||||
winners.awards_prizes_id='{$pr->id}'
|
winners.awards_prizes_id='{$pr->id}'
|
||||||
$fairs_where ");
|
$fairs_where ");
|
||||||
$cq->execute();
|
$cq->execute();
|
||||||
echo $pdo->errorInfo();
|
show_pdo_errors_if_any($pdo);
|
||||||
$count = $cq->rowCount();
|
$count = $cq->rowCount();
|
||||||
// echo "winners=$count";
|
// echo "winners=$count";
|
||||||
|
|
||||||
|
@ -845,18 +845,22 @@ function emit_time_selector($name,$selected="")
|
|||||||
function emit_province_selector($name,$selected="",$extra="")
|
function emit_province_selector($name,$selected="",$extra="")
|
||||||
{
|
{
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
global $pdo;
|
global $pdo;
|
||||||
$q=$pdo->prepare("SELECT * FROM provinces WHERE countries_code='".$config['country']."' ORDER BY province");
|
$q=$pdo->prepare("SELECT * FROM provinces WHERE countries_code='".$config['country']."' ORDER BY province");
|
||||||
$q->execute();
|
$q->execute();
|
||||||
|
|
||||||
if($q->rowCount()==1)
|
if($q->rowCount()==1)
|
||||||
{
|
{
|
||||||
$r = $q->fetch();
|
$r = $q->fetch();
|
||||||
echo "<input type=\"hidden\" name=\"$name\" value=\"$r-code\">";
|
|
||||||
|
echo "<input type=\"hidden\" name=\"$name\" value=\"$r->code\">";
|
||||||
echo i18n($r->province);
|
echo i18n($r->province);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
echo "<select name=\"$name\" $extra>\n";
|
echo "<select name=\"$name\" $extra>\n";
|
||||||
|
|
||||||
echo "<option value=\"\">".i18n("Select a {$config['provincestate']}")."</option>\n";
|
echo "<option value=\"\">".i18n("Select a {$config['provincestate']}")."</option>\n";
|
||||||
while($r = $q->fetch())
|
while($r = $q->fetch())
|
||||||
{
|
{
|
||||||
|
@ -40,12 +40,18 @@
|
|||||||
if(get_value_from_array($_POST,'usepostamble')) $usepa="1"; else $usepa="0";
|
if(get_value_from_array($_POST,'usepostamble')) $usepa="1"; else $usepa="0";
|
||||||
if(get_value_from_array($_POST, 'useregfee')) $userf="1"; else $userf="0";
|
if(get_value_from_array($_POST, 'useregfee')) $userf="1"; else $userf="0";
|
||||||
|
|
||||||
$stmt = $pdo->prepare("UPDATE signaturepage SET `use`='$useex', `text`='".get_value_from_array($_POST,'exhibitordeclaration')."' WHERE name='exhibitordeclaration'");
|
$val = get_value_from_array($_POST, 'exhibitordeclaration');
|
||||||
$stmt->execute();
|
$stmt = $pdo->prepare("UPDATE signaturepage SET `use` = :useex, `text` = :text WHERE name = 'exhibitordeclaration'");
|
||||||
$stmt = $pdo->prepare("UPDATE signaturepage SET `use`='$usepg', `text`='".get_value_from_array($_POST, 'parentdeclaration')."' WHERE name='parentdeclaration'");
|
$stmt->bindParam(':useex', $useex);
|
||||||
$stmt->execute();
|
$stmt->bindParam(':text', $val);
|
||||||
$stmt = $pdo->prepare("UPDATE signaturepage SET `use`='$usete', `text`='".get_value_from_array($_POST, 'teacherdeclaration')."' WHERE name='teacherdeclaration'");
|
$stmt->execute();
|
||||||
$stmt->execute();
|
|
||||||
|
$val = get_value_from_array($_POST, 'exhibitordeclaration');
|
||||||
|
$stmt = $pdo->prepare("UPDATE signaturepage SET `use` = :usepg, `text` = :text WHERE name = 'parentdeclaration'");
|
||||||
|
$stmt->bindParam(':usepg', $usepg);
|
||||||
|
$stmt->bindParam(':text', $val);
|
||||||
|
$stmt->execute();
|
||||||
|
|
||||||
$stmt = $pdo->prepare("UPDATE signaturepage SET `use`='$usepa', `text`='".get_value_from_array($_POST,'postamble')."' WHERE name='postamble'");
|
$stmt = $pdo->prepare("UPDATE signaturepage SET `use`='$usepa', `text`='".get_value_from_array($_POST,'postamble')."' WHERE name='postamble'");
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
$stmt = $pdo->prepare("UPDATE signaturepage SET `use`='$userf', `text`='' WHERE name='regfee'");
|
$stmt = $pdo->prepare("UPDATE signaturepage SET `use`='$userf', `text`='' WHERE name='regfee'");
|
||||||
|
7
lcsv.php
7
lcsv.php
@ -73,7 +73,12 @@ class lcsv
|
|||||||
foreach($table['data'] AS $dataline) {
|
foreach($table['data'] AS $dataline) {
|
||||||
for($c=0;$c<$table_cols;$c++) {
|
for($c=0;$c<$table_cols;$c++) {
|
||||||
//escape a single " with ""
|
//escape a single " with ""
|
||||||
$dataline_c=str_replace('"','""',$dataline[$c]);
|
$returned_value = get_value_from_array($dataline, $c, '');
|
||||||
|
if(is_object($returned_value) === false)
|
||||||
|
{ echo is_object($returned_value);
|
||||||
|
$dataline_c=str_replace('"','""',get_value_from_array($dataline, $c, ''));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//lets always quote it
|
//lets always quote it
|
||||||
$this->csvdata.="\"".$dataline_c."\"";
|
$this->csvdata.="\"".$dataline_c."\"";
|
||||||
|
5
lpdf.php
5
lpdf.php
@ -64,6 +64,8 @@ class lpdf
|
|||||||
var $normalfont;
|
var $normalfont;
|
||||||
var $boldfont;
|
var $boldfont;
|
||||||
|
|
||||||
|
var $content_width ;
|
||||||
|
|
||||||
function loc($inch)
|
function loc($inch)
|
||||||
{
|
{
|
||||||
return $inch*72;
|
return $inch*72;
|
||||||
@ -121,7 +123,8 @@ class lpdf
|
|||||||
}
|
}
|
||||||
|
|
||||||
function newPage($width="",$height="",$pagenumber=0)
|
function newPage($width="",$height="",$pagenumber=0)
|
||||||
{
|
{
|
||||||
|
|
||||||
if($width && $height)
|
if($width && $height)
|
||||||
{
|
{
|
||||||
$this->page_width=$width;
|
$this->page_width=$width;
|
||||||
|
@ -1013,9 +1013,10 @@ class TableEditor
|
|||||||
list($sel, $from, $where) = $this->defaultGetList();
|
list($sel, $from, $where) = $this->defaultGetList();
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach($sel as $s) $query .= ",$s";
|
foreach($sel as $s) $query .= ", $s";
|
||||||
$query .= " FROM ";
|
$query .= " FROM ";
|
||||||
foreach($from as $f) $query .= "$f ";
|
foreach($from as $f) $query .= "$f ";
|
||||||
|
print("sfs $f");
|
||||||
$query .= " WHERE 1 ";
|
$query .= " WHERE 1 ";
|
||||||
|
|
||||||
if(is_array($where)) {
|
if(is_array($where)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user