Początkujący
Postów: 152 Ostrzeżeń: 2
Data rejestracji: 28.04.2007 18:08
|
Witam, wydaję mi się że w odpowiednim dziale piszę, jeśli coś namieszałem to przepraszam.
Proszę o małą pomoc, przerobiłem jedną wtyczkę pod swoją potrzebę, w sumie z oryginalnego kodu zostały tylko selekty, a raczej połowa z nich. Niestety nie znam się na wyciąganiu informacji z BD.
Pewnie namieszałem sporo. Ale proszę o pomoc.
Może ktoś by mi to w prosty sposób wytłumaczył jak to się robi.
Dla wyjaśnienia powiem tylko, że jest mi potrzebna tylko tabela id, temat, 20 odpowiedzi i tabela z datą, resztę mnie nie interesuje i są pozostałościami z poprzedniej wtyczki.
Wszystkie pliki wrzuciłem jako załącznik. Instaluje się jak normalną wtyczkę. Wrzuciłem także dwie klasy css i grafikę do nich.
infusion.php
$inf_newtable[1] = DB_STUDENT_SURVEY." (
survey_id SMALLINT(5) UNSIGNED NOT NULL AUTO_INCREMENT,
survey_summary VARCHAR(200) DEFAULT '' NOT NULL,
survey_description_od1 TEXT NOT NULL,
survey_description_od2 TEXT NOT NULL,
survey_description_od3 TEXT NOT NULL,
survey_description_od4 TEXT NOT NULL,
survey_description_od5 TEXT NOT NULL,
survey_description_od6 TEXT NOT NULL,
survey_description_od7 TEXT NOT NULL,
survey_description_od8 TEXT NOT NULL,
survey_description_od9 TEXT NOT NULL,
survey_description_od10 TEXT NOT NULL,
survey_description_od11 TEXT NOT NULL,
survey_description_od12 TEXT NOT NULL,
survey_description_od13 TEXT NOT NULL,
survey_description_od14 TEXT NOT NULL,
survey_description_od15 TEXT NOT NULL,
survey_description_od16 TEXT NOT NULL,
survey_description_od17 TEXT NOT NULL,
survey_description_od18 TEXT NOT NULL,
survey_description_od19 TEXT NOT NULL,
survey_description_od20 TEXT NOT NULL,
survey_datestamp INT(10) UNSIGNED DEFAULT '0' NOT NULL,
PRIMARY KEY (survey_id)
) ENGINE=MyISAM;";
Kliknij i zaczekaj na załadowanie kodu ...
student_survey.php
<?php
require_once "../../maincore.php";
require_once THEMES."templates/header.php";
include INFUSIONS."student_survey/infusion_db.php";
if (file_exists(INFUSIONS."student_survey/locale/".$settings['locale'].".php")) {
include INFUSIONS."student_survey/locale/".$settings['locale'].".php";
}
$step = isset($_REQUEST['step']) ? $_REQUEST['step'] : "";
$survey_id = (isset($_REQUEST['survey_id']) AND isnum($_REQUEST['survey_id'])) ? $_REQUEST['survey_id'] : "";
if (isset($_POST['submit_survey'])) {
$survey_summary = stripinput($_POST['survey_summary']);
$survey_description = stripinput($_POST['survey_description']);
if ($survey_summary != "" && $survey_description != "") {
$result = dbquery("INSERT INTO ".DB_STUDENT_SURVEY." (survey_summary, survey_description_od1, survey_description_od2, survey_description_od3, survey_description_od4, survey_description_od5, survey_description_od6, survey_description_od7, survey_description_od8, survey_description_od9, survey_description_od10, survey_description_od11, survey_description_od12, survey_description_od13, survey_description_od14, survey_description_od15, survey_description_od16, survey_description_od17, survey_description_od18, survey_description_od19, survey_description_od20, survey_datestamp) VALUES('$survey_summary', '$survey_description_od1', '$survey_description_od2', '$survey_description_od3', '$survey_description_od4', '$survey_description_od5', '$survey_description_od6', '$survey_description_od7', '$survey_description_od8', '$survey_description_od9', '$survey_description_od10', '$survey_description_od11', '$survey_description_od12', '$survey_description_od13', '$survey_description_od14', '$survey_description_od15', '$survey_description_od16', '$survey_description_od17', '$survey_description_od18', '$survey_description_od19', '$survey_description_od20', '".time()."')");
}
redirect(FUSION_SELF);
}
if ($step == "view") {
if (!$survey_id || !isnum($survey_id)) { redirect(FUSION_SELF); }
//-------------------------------------------------------------------------------------------------------------------//
opentable($locale['ann110']);
$result = dbquery("SELECT ter.*, user_id,user_name FROM ".DB_STUDENT_SURVEY." ter LEFT JOIN ".DB_USERS." tusr ON ter.survey_user=tusr.user_id WHERE survey_id='".$survey_id."'");
$data = dbarray($result);
if (!dbrows($result)) { redirect(FUSION_SELF); }
echo "<table width='100%' cellpadding='0' cellspacing='1' class='tbl-border'>";
echo "<tr><td colspan='3' class='tbl2'><strong>".$locale['ann119']."</strong></td></tr>";
echo "<tr><td width='125' class='tbl2'>".$locale['ann111']."</td>";
echo "<td colspan='2' class='tbl1'>".$data['survey_summary']." --- ".strftime($settings['longdate'], $data['survey_datestamp']+($settings['timeoffset']*3600))."</td></tr>";
echo "<tr><td width='125' class='tbl2'>".$locale['ann200']."</td>";
echo "<td colspan='2'class='tbl1'>".nl2br($data['survey_description_od1'])."</td></tr>\n";
echo "<tr><td width='125' class='tbl2'>".$locale['ann201']."</td>";
echo "<td colspan='2'class='tbl1'>".nl2br($data['survey_description_od2'])."</td></tr>\n";
echo "<tr><td width='125' class='tbl2'>".$locale['ann202']."</td>";
echo "<td colspan='2'class='tbl1'>".nl2br($data['survey_description_od3'])."</td></tr>\n";
echo "<tr><td width='125' class='tbl2'>".$locale['ann203']."</td>";
echo "<td colspan='2'class='tbl1'>".nl2br($data['survey_description_od4'])."</td></tr>\n";
echo "<tr><td width='125' class='tbl2'>".$locale['ann204']."</td>";
echo "<td colspan='2'class='tbl1'>".nl2br($data['survey_description_od5'])."</td></tr>\n";
echo "<tr><td width='125' class='tbl2'>".$locale['ann205']."</td>";
echo "<td colspan='2'class='tbl1'>".nl2br($data['survey_description_od6'])."</td></tr>\n";
echo "<tr><td width='125' class='tbl2'>".$locale['ann206']."</td>";
echo "<td colspan='2'class='tbl1'>".nl2br($data['survey_description_od7'])."</td></tr>\n";
echo "<tr><td width='125' class='tbl2'>".$locale['ann207']."</td>";
echo "<td colspan='2'class='tbl1'>".nl2br($data['survey_description_od8'])."</td></tr>\n";
echo "<tr><td width='125' class='tbl2'>".$locale['ann208']."</td>";
echo "<td colspan='2'class='tbl1'>".nl2br($data['survey_description_od9'])."</td></tr>\n";
echo "<tr><td width='125' class='tbl2'>".$locale['ann209']."</td>";
echo "<td colspan='2'class='tbl1'>".nl2br($data['survey_description_od10'])."</td></tr>\n";
echo "<tr><td width='125' class='tbl2'>".$locale['ann210']."</td>";
echo "<td colspan='2'class='tbl1'>".nl2br($data['survey_description_od11'])."</td></tr>\n";
echo "<tr><td width='125' class='tbl2'>".$locale['ann211']."</td>";
echo "<td colspan='2'class='tbl1'>".nl2br($data['survey_description_od12'])."</td></tr>\n";
echo "<tr><td width='125' class='tbl2'>".$locale['ann212']."</td>";
echo "<td colspan='2'class='tbl1'>".nl2br($data['survey_description_od13'])."</td></tr>\n";
echo "<tr><td width='125' class='tbl2'>".$locale['ann213']."</td>";
echo "<td colspan='2'class='tbl1'>".nl2br($data['survey_description_od14'])."</td></tr>\n";
echo "<tr><td width='125' class='tbl2'>".$locale['ann214']."</td>";
echo "<td colspan='2'class='tbl1'>".nl2br($data['survey_description_od15'])."</td></tr>\n";
echo "<tr><td width='125' class='tbl2'>".$locale['ann215']."</td>";
echo "<td colspan='2'class='tbl1'>".nl2br($data['survey_description_od16'])."</td></tr>\n";
echo "<tr><td width='125' class='tbl2'>".$locale['ann216']."</td>";
echo "<td colspan='2'class='tbl1'>".nl2br($data['survey_description_od17'])."</td></tr>\n";
echo "<tr><td width='125' class='tbl2'>".$locale['ann217']."</td>";
echo "<td colspan='2'class='tbl1'>".nl2br($data['survey_description_od18'])."</td></tr>\n";
echo "<tr><td width='125' class='tbl2'>".$locale['ann218']."</td>";
echo "<td colspan='2'class='tbl1'>".nl2br($data['survey_description_od19'])."</td></tr>\n";
echo "<tr><td width='125' class='tbl2'>".$locale['ann219']."</td>";
echo "<td colspan='2'class='tbl1'>".nl2br($data['survey_description_od20'])."</td></tr>\n";
echo "</table>\n";
closetable();
}
//------------------------------------------------------------------------------------------------------------------//
opentable($locale['ann120']);
$result = dbquery( "SELECT ter.*, user_id,user_name, COUNT(comment_item_id) AS survey_comments FROM ".DB_STUDENT_SURVEY." ter LEFT JOIN ".DB_USERS." tusr ON ter.survey_user=tusr.user_id LEFT JOIN ".DB_COMMENTS." ON ter.survey_id=comment_item_id AND comment_type='E' GROUP BY survey_id ORDER BY survey_datestamp DESC" );
if (dbrows($result)) {
$i = 0;
echo "<table width='100%' cellpadding='0' cellspacing='1' class='tbl-border'>";
echo "<tr><td align='center' width='75' class='tbl2'>".$locale['ann121']."</td>";
echo "<td class='tbl2'>".$locale['ann122']."</td>";
while ($data = dbarray($result)) {
$i % 2 == 0 ? $tclass="tbl1" : $tclass="tbl2";
echo "<tr><td align='center' class='$tclass'>".$data['survey_id']."</td>";
echo "<td class='$tclass'><a href='".FUSION_SELF."?step=view&survey_id=".$data['survey_id']."'>".$locale['ann118']."</a> --- ".$data['survey_summary']." --- ".strftime($settings['longdate'], $data['survey_datestamp']+($settings['timeoffset']*3600))."</td>";
}
echo "</table>\n";
}
else {
echo "<center><br />\n".$locale['ann123']."<br /><br />\n</center>\n";
}
closetable();
//------------------------------------------------------------------------------------------------------------------//
opentable($locale['ann000']);
echo "<form name='reportform' method='post' action='".FUSION_SELF."'>";
echo "<br/>".$locale['ann001']."<br/><br/><br/>\n";
echo "<table>\n";
echo "<tr>\n";
echo "<td>".$locale['ann112']."</td>\n";
echo "<td><input type='text' name='survey_summary' size='40'/></td>\n";
echo "</tr>\n";
echo "</table><br/><br/>\n";
echo "<table>".$locale['ann300']."<br/><br/>\n";
echo "<tr><td><input type='radio' name='survey_description_od1' value='1'/>".$locale['ann400']."</td></tr>\n";
echo "<tr><td><input type='radio' name='survey_description_od1' value='2'/>".$locale['ann401']."</td></tr>\n";
echo "<tr><td><input type='radio' name='survey_description_od1' value='3'/>".$locale['ann402']."</td></tr>\n";
echo "<tr><td><input type='radio' name='survey_description_od1' value='4'/>".$locale['ann403']."</td></tr>\n";
echo "</table><br/><br/>\n";
echo "<table>".$locale['ann301']."\n";
echo "<tr><td><input type='radio' name='survey_description_od2' value='1'/>".$locale['ann410']."</td></tr>\n";
echo "<tr><td><input type='radio' name='survey_description_od2' value='2'/>".$locale['ann411']."</td></tr>\n";
echo "<tr><td><input type='radio' name='survey_description_od2' value='3'/>".$locale['ann412']."</td></tr>\n";
echo "<tr><td><input type='radio' name='survey_description_od2' value='4'/>".$locale['ann413']."</td></tr>\n";
echo "</table><br/><br/>\n";
echo "<table>".$locale['ann302']."\n";
echo "<tr><td><input type='radio' name='survey_description_od3' value='1'/>".$locale['ann420']."</td></tr>\n";
echo "<tr><td><input type='radio' name='survey_description_od3' value='2'/>".$locale['ann421']."</td></tr>\n";
echo "<tr><td><input type='radio' name='survey_description_od3' value='3'/>".$locale['ann422']."</td></tr>\n";
echo "<tr><td><input type='radio' name='survey_description_od3' value='4'/>".$locale['ann423']."</td></tr>\n";
echo "</table><br/><br/>\n";
echo "<table>".$locale['ann303']."\n";
echo "<tr><td><input type='radio' name='survey_description_od4' value='1'/>".$locale['ann430']."</td></tr>\n";
echo "<tr><td><input type='radio' name='survey_description_od4' value='2'/>".$locale['ann431']."</td></tr>\n";
echo "<tr><td><input type='radio' name='survey_description_od4' value='3'/>".$locale['ann432']."</td></tr>\n";
echo "<tr><td><input type='radio' name='survey_description_od4' value='4'/>".$locale['ann433']."</td></tr>\n";
echo "</table><br/><br/>\n";
echo "<table>".$locale['ann304']."\n";
echo "<tr><td><input type='radio' name='survey_description_od5' value='1'/>".$locale['ann440']."</td></tr>\n";
echo "<tr><td><input type='radio' name='survey_description_od5' value='2'/>".$locale['ann441']."</td></tr>\n";
echo "<tr><td><input type='radio' name='survey_description_od5' value='3'/>".$locale['ann442']."</td></tr>\n";
echo "<tr><td><input type='radio' name='survey_description_od5' value='4'/>".$locale['ann443']."</td></tr>\n";
echo "</table><br/><br/>\n";
echo "<table>".$locale['ann305']."\n";
echo "<tr><td><input type='radio' name='survey_description_od6' value='1'/>".$locale['ann450']."</td></tr>\n";
echo "<tr><td><input type='radio' name='survey_description_od6' value='2'/>".$locale['ann451']."</td></tr>\n";
echo "<tr><td><input type='radio' name='survey_description_od6' value='3'/>".$locale['ann452']."</td></tr>\n";
echo "<tr><td><input type='radio' name='survey_description_od6' value='4'/>".$locale['ann453']."</td></tr>\n";
echo "</table><br/><br/>\n";
echo "<table>".$locale['ann306']."\n";
echo "<tr><td><input type='radio' name='survey_description_od7' value='1'/>".$locale['ann460']."</td></tr>\n";
echo "<tr><td><input type='radio' name='survey_description_od7' value='2'/>".$locale['ann461']."</td></tr>\n";
echo "<tr><td><input type='radio' name='survey_description_od7' value='3'/>".$locale['ann462']."</td></tr>\n";
echo "<tr><td><input type='radio' name='survey_description_od7' value='4'/>".$locale['ann463']."</td></tr>\n";
echo "</table><br/><br/>\n";
echo "<table>".$locale['ann307']."\n";
echo "<tr><td><input type='radio' name='survey_description_od8' value='1'/>".$locale['ann470']."</td></tr>\n";
echo "<tr><td><input type='radio' name='survey_description_od8' value='2'/>".$locale['ann471']."</td></tr>\n";
echo "<tr><td><input type='radio' name='survey_description_od8' value='3'/>".$locale['ann472']."</td></tr>\n";
echo "<tr><td><input type='radio' name='survey_description_od8' value='4'/>".$locale['ann473']."</td></tr>\n";
echo "</table><br/><br/>\n";
echo "<table>".$locale['ann308']."\n";
echo "<tr><td><input type='radio' name='survey_description_od9' value='1'/>".$locale['ann480']."</td></tr>\n";
echo "<tr><td><input type='radio' name='survey_description_od9' value='2'/>".$locale['ann481']."</td></tr>\n";
echo "<tr><td><input type='radio' name='survey_description_od9' value='3'/>".$locale['ann482']."</td></tr>\n";
echo "<tr><td><input type='radio' name='survey_description_od9' value='4'/>".$locale['ann483']."</td></tr>\n";
echo "</table><br/><br/>\n";
echo "<table>".$locale['ann309']."\n";
echo "<tr><td><input type='radio' name='survey_description_od10' value='1'/>".$locale['ann490']."</td></tr>\n";
echo "<tr><td><input type='radio' name='survey_description_od10' value='2'/>".$locale['ann491']."</td></tr>\n";
echo "<tr><td><input type='radio' name='survey_description_od10' value='3'/>".$locale['ann492']."</td></tr>\n";
echo "<tr><td><input type='radio' name='survey_description_od10' value='4'/>".$locale['ann493']."</td></tr>\n";
echo "</table><br/><br/>\n";
echo "<table align='center'>".$locale['ann310']."<br/><br/>\n";
echo "<tr>\n";
echo "<td><textarea rows='10' name='survey_description_od11' cols='60'></textarea></td>\n";
echo "</tr>\n";
echo "</table><br/><br/>\n";
echo "<table align='center'>".$locale['ann311']."<br/><br/>\n";
echo "<tr>\n";
echo "<td><textarea rows='10' name='survey_description_od12' cols='60'></textarea></td>\n";
echo "</tr>\n";
echo "</table><br/><br/>\n";
echo "<table align='center'>".$locale['ann312']."<br/><br/>\n";
echo "<tr>\n";
echo "<td><textarea rows='10' name='survey_description_od13' cols='60'></textarea></td>\n";
echo "</tr>\n";
echo "</table><br/><br/>\n";
echo "<table align='center'>".$locale['ann313']."<br/><br/>\n";
echo "<tr>\n";
echo "<td><textarea rows='10' name='survey_description_od14' cols='60'></textarea></td>\n";
echo "</tr>\n";
echo "</table><br/><br/>\n";
echo "<table align='center'>".$locale['ann314']."<br/><br/>\n";
echo "<tr>\n";
echo "<td><textarea rows='10' name='survey_description_od15' cols='60'></textarea></td>\n";
echo "</tr>\n";
echo "</table><br/><br/>\n";
echo "<table align='center'>".$locale['ann315']."<br/><br/>\n";
echo "<tr>\n";
echo "<td><textarea rows='10' name='survey_description_od16' cols='60'></textarea></td>\n";
echo "</tr>\n";
echo "</table><br/><br/>\n";
echo "<table align='center'>".$locale['ann316']."<br/><br/>\n";
echo "<tr>\n";
echo "<td><textarea rows='10' name='survey_description_od17' cols='60'></textarea></td>\n";
echo "</tr>\n";
echo "</table><br/><br/>\n";
echo "<table align='center'>".$locale['ann317']."<br/><br/>\n";
echo "<tr>\n";
echo "<td><textarea rows='10' name='survey_description_od18' cols='60'></textarea></td>\n";
echo "</tr>\n";
echo "</table><br/><br/>\n";
echo "<table align='center'>".$locale['ann318']."<br/><br/>\n";
echo "<tr>\n";
echo "<td><textarea rows='10' name='survey_description_od19' cols='60'></textarea></td>\n";
echo "</tr>\n";
echo "</table><br/><br/>\n";
echo "<table align='center'>".$locale['ann319']."<br/><br/>\n";
echo "<tr>\n";
echo "<td><textarea rows='10' name='survey_description_od20' cols='60'></textarea></td>\n";
echo "</tr>\n";
echo "</table><br/><br/>\n";
echo "<table align='center'>\n";
echo "<tr>\n";
echo "<td align='left' height='50' width='300'>".$locale['ann002']."</td>\n";
echo "<td align='right' height='28' width='132'><input type='submit' name='submit_survey' value='".$locale['ann004']."' class='button-survey'/></td>\n";
echo "</tr>\n";
echo "</table><br/><br/></form>\n";
closetable();
require_once THEMES."templates/footer.php";
?>
Kliknij i zaczekaj na załadowanie kodu ...
student_survey_admin.php
<?php
require_once "../../maincore.php";
require_once THEMES."templates/admin_header.php";
include INFUSIONS."student_survey/infusion_db.php";
if (file_exists(INFUSIONS."student_survey/locale/".$settings['locale'].".php")) {
include INFUSIONS."student_survey/locale/".$settings['locale'].".php";
} else {
include INFUSIONS."student_survey/locale/English.php";
}
if (!checkrights("ERR") || !defined("iAUTH") || $_GET['aid'] != iAUTH) { redirect("../index.php"); }
$step = isset($_REQUEST['step']) ? $_REQUEST['step'] : "";
$survey_id = (isset($_REQUEST['survey_id']) AND isnum($_REQUEST['survey_id'])) ? $_REQUEST['survey_id'] : "";
if ($step == "delete") {
$result = dbquery("DELETE FROM ".DB_STUDENT_SURVEY." WHERE survey_id='$survey_id'");
redirect(FUSION_SELF.$aidlink);
}
if ($step == "view") {
if (!$survey_id || !isnum($survey_id)) { redirect(FUSION_SELF.$aidlink); }
//----------------------------------------------------------------------------------------------------------------//
opentable($locale['ann110']);
$data = dbarray(dbquery(
"SELECT ter.*, user_id,user_name FROM "
.DB_STUDENT_SURVEY." ter
LEFT JOIN "
.DB_USERS." tusr ON ter.survey_user=tusr.user_id
WHERE survey_id='"
.$survey_id."'"
));
echo "<table width='100%' cellpadding='0' cellspacing='1' class='tbl-border'>\n";
echo "<tr><td colspan='2' class='tbl2'><b>".$locale['ann119']."</b></td></tr>\n";
echo "<tr><td width='125' class='tbl2'>".$locale['ann111']."</td>\n";
echo "<td class='tbl1'>".$data['survey_summary']." --- ".strftime($settings['longdate'], $data['survey_datestamp']+($settings['timeoffset']*3600))."</td></tr>\n";
echo "<tr><td width='125' class='tbl2'>".$locale['ann200']."</td>";
echo "<td colspan='2'class='tbl1'>".nl2br($data['survey_description_od1'])."</td></tr>\n";
echo "<tr><td width='125' class='tbl2'>".$locale['ann201']."</td>";
echo "<td colspan='2'class='tbl1'>".nl2br($data['survey_description_od2'])."</td></tr>\n";
echo "<tr><td width='125' class='tbl2'>".$locale['ann202']."</td>";
echo "<td colspan='2'class='tbl1'>".nl2br($data['survey_description_od3'])."</td></tr>\n";
echo "<tr><td width='125' class='tbl2'>".$locale['ann203']."</td>";
echo "<td colspan='2'class='tbl1'>".nl2br($data['survey_description_od4'])."</td></tr>\n";
echo "<tr><td width='125' class='tbl2'>".$locale['ann204']."</td>";
echo "<td colspan='2'class='tbl1'>".nl2br($data['survey_description_od5'])."</td></tr>\n";
echo "<tr><td width='125' class='tbl2'>".$locale['ann205']."</td>";
echo "<td colspan='2'class='tbl1'>".nl2br($data['survey_description_od6'])."</td></tr>\n";
echo "<tr><td width='125' class='tbl2'>".$locale['ann206']."</td>";
echo "<td colspan='2'class='tbl1'>".nl2br($data['survey_description_od7'])."</td></tr>\n";
echo "<tr><td width='125' class='tbl2'>".$locale['ann207']."</td>";
echo "<td colspan='2'class='tbl1'>".nl2br($data['survey_description_od8'])."</td></tr>\n";
echo "<tr><td width='125' class='tbl2'>".$locale['ann208']."</td>";
echo "<td colspan='2'class='tbl1'>".nl2br($data['survey_description_od9'])."</td></tr>\n";
echo "<tr><td width='125' class='tbl2'>".$locale['ann209']."</td>";
echo "<td colspan='2'class='tbl1'>".nl2br($data['survey_description_od10'])."</td></tr>\n";
echo "<tr><td width='125' class='tbl2'>".$locale['ann210']."</td>";
echo "<td colspan='2'class='tbl1'>".nl2br($data['survey_description_od11'])."</td></tr>\n";
echo "<tr><td width='125' class='tbl2'>".$locale['ann211']."</td>";
echo "<td colspan='2'class='tbl1'>".nl2br($data['survey_description_od12'])."</td></tr>\n";
echo "<tr><td width='125' class='tbl2'>".$locale['ann212']."</td>";
echo "<td colspan='2'class='tbl1'>".nl2br($data['survey_description_od13'])."</td></tr>\n";
echo "<tr><td width='125' class='tbl2'>".$locale['ann213']."</td>";
echo "<td colspan='2'class='tbl1'>".nl2br($data['survey_description_od14'])."</td></tr>\n";
echo "<tr><td width='125' class='tbl2'>".$locale['ann214']."</td>";
echo "<td colspan='2'class='tbl1'>".nl2br($data['survey_description_od15'])."</td></tr>\n";
echo "<tr><td width='125' class='tbl2'>".$locale['ann215']."</td>";
echo "<td colspan='2'class='tbl1'>".nl2br($data['survey_description_od16'])."</td></tr>\n";
echo "<tr><td width='125' class='tbl2'>".$locale['ann216']."</td>";
echo "<td colspan='2'class='tbl1'>".nl2br($data['survey_description_od17'])."</td></tr>\n";
echo "<tr><td width='125' class='tbl2'>".$locale['ann217']."</td>";
echo "<td colspan='2'class='tbl1'>".nl2br($data['survey_description_od18'])."</td></tr>\n";
echo "<tr><td width='125' class='tbl2'>".$locale['ann218']."</td>";
echo "<td colspan='2'class='tbl1'>".nl2br($data['survey_description_od19'])."</td></tr>\n";
echo "<tr><td width='125' class='tbl2'>".$locale['ann219']."</td>";
echo "<td colspan='2'class='tbl1'>".nl2br($data['survey_description_od20'])."</td></tr>\n";
echo "</table>\n";
closetable();
tablebreak();
}
//------------------------------------------------------------------------------------------------------------------//
opentable($locale['ann120']);
$result = dbquery(
"SELECT ter.*, user_id,user_name FROM "
.DB_STUDENT_SURVEY." ter
LEFT JOIN "
.DB_USERS." tusr ON ter.survey_user=tusr.user_id
ORDER BY survey_datestamp DESC"
);
if (dbrows($result)) {
$i = 0;
echo "<table width='100%' cellpadding='0' cellspacing='1' class='tbl-border'>\n";
echo "<tr><td align='center' width='75' class='tbl2'>".$locale['ann121']."</td>\n";
echo "<td class='tbl2'>".$locale['ann122']."</td>\n";
echo "<td align='center' width='100' class='tbl2'>".$locale['ann150']."</td></tr>\n";
while ($data = dbarray($result)) {
$i % 2 == 0 ? $tclass="tbl1" : $tclass="tbl2";
echo "<tr><td align='center' class='$tclass'>".$data['survey_id']."</td>\n";
echo "<td class='$tclass'><a href='".FUSION_SELF.$aidlink."&step=view&survey_id=".$data['survey_id']."'>".$locale['ann118']."</a> --- ".$data['survey_summary']." --- ".strftime($settings['longdate'], $data['survey_datestamp']+($settings['timeoffset']*3600))."</td>\n";
echo "<td align='center' class='$tclass'><a href='".FUSION_SELF.$aidlink."&step=delete&survey_id=".$data['survey_id']."'>".$locale['ann151']."</a></td></tr>\n";
}
echo "</table>\n";
}
else {
echo "<center><br />\n".$locale['ann123']."<br /><br />\n</center>\n";
}
closetable();
require_once THEMES."templates/footer.php";
?>
Kliknij i zaczekaj na załadowanie kodu ...
-----------------------------------------------------------------------
Małe problemy z tematem ale już wszystko wróciło do normy. Kontynuując temat wprowadziłem modyfikację
student_survey.php linia 15-20
if (isset($_POST['submit_survey'])) {
$survey_summary = stripinput($_POST['survey_summary']);
$survey_description = stripinput($_POST['survey_description']);
if ($survey_summary != "" && $survey_description != "") {
$result = dbquery("INSERT INTO ".DB_STUDENT_SURVEY." (survey_summary, survey_description_od1, survey_description_od2, survey_description_od3, survey_description_od4, survey_description_od5, survey_description_od6, survey_description_od7, survey_description_od8, survey_description_od9, survey_description_od10, survey_description_od11, survey_description_od12, survey_description_od13, survey_description_od14, survey_description_od15, survey_description_od16, survey_description_od17, survey_description_od18, survey_description_od19, survey_description_od20, survey_datestamp) VALUES('$survey_summary', '$survey_description_od1', '$survey_description_od2', '$survey_description_od3', '$survey_description_od4', '$survey_description_od5', '$survey_description_od6', '$survey_description_od7', '$survey_description_od8', '$survey_description_od9', '$survey_description_od10', '$survey_description_od11', '$survey_description_od12', '$survey_description_od13', '$survey_description_od14', '$survey_description_od15', '$survey_description_od16', '$survey_description_od17', '$survey_description_od18', '$survey_description_od19', '$survey_description_od20', '".time()."')");
}
Kliknij i zaczekaj na załadowanie kodu ...
na następującą
if (isset($_POST['submit_survey'])) {
$survey_summary = stripinput($_POST['survey_summary']);
$survey_description = array();
for ($i = 1; $i < 21; $i++) {
$survey_description[$i] = stripinput($_POST['survey_description_od'.$i]);
}
$check = 1;
$i = 1;
while ($check && $j < 21) {
if ($survey_description[$i] == "") {
$check = 0;
}
}
if ($survey_summary != "" && $check) {
$result = dbquery("INSERT INTO ".DB_STUDENT_SURVEY." (survey_summary, survey_description_od1, survey_description_od2, survey_description_od3, survey_description_od4, survey_description_od5, survey_description_od6, survey_description_od7, survey_description_od8, survey_description_od9, survey_description_od10, survey_description_od11, survey_description_od12, survey_description_od13, survey_description_od14, survey_description_od15, survey_description_od16, survey_description_od17, survey_description_od18, survey_description_od19, survey_description_od20, survey_datestamp) VALUES('$survey_summary', '$survey_description[1]', '$survey_description[2]', '$survey_description[3]', '$survey_description[4]', '$survey_description[5]', '$survey_description[6]', '$survey_description[7]', '$survey_description[8]', '$survey_description[9]', '$survey_description[10]', '$survey_description[11]', '$survey_description[12]', '$survey_description[13]', '$survey_description[14]', '$survey_description[15]', '$survey_description[16]', '$survey_description[17]', '$survey_description[18]', '$survey_description[19]', '$survey_description[20]', '".time()."')");
Kliknij i zaczekaj na załadowanie kodu ...
powinno działać, ale gdzieś jest jakiś mały błąd, pewnie jakiś znak. W którymś momencie dodawało wszystko ładnie do BD, ale coś musiałem źle wstawić i "mieli" przy wysyłaniu.
ELO320 dodał/a następującą plik:
Edytowane przez ELO320 dnia 20.12.2011 15:25:52
Wciśnij pomógł! To nie gryzie!
|
Początkujący
Postów: 152 Ostrzeżeń: 2
Data rejestracji: 28.04.2007 18:08
|
Dzięki za to, ale to nic nie zmienia. Baza dodawała się prawidłowo, więc nie ma to wpływu raczej.
Chodzi o to że jak powpisuje dane w ankietę to się nie dodają, "mieli" mi i pojawia się czarny ekran, w kodzie na dole jest gdzieś błąd ale nie wiem gdzie.
student_survey.php
if (isset($_POST['submit_survey'])) {
$survey_summary = stripinput($_POST['survey_summary']);
$survey_description = array();
for ($i = 1; $i < 21; $i++) {
$survey_description[$i] = stripinput($_POST['survey_description_od'.$i]);
}
$check = 1;
$i = 1;
while ($check && $j < 21) {
if ($survey_description[$i] == "") {
$check = 0;
}
}
if ($survey_summary != "" && $check) {
$result = dbquery("INSERT INTO ".DB_STUDENT_SURVEY." (survey_summary, survey_description_od1, survey_description_od2, survey_description_od3, survey_description_od4, survey_description_od5, survey_description_od6, survey_description_od7, survey_description_od8, survey_description_od9, survey_description_od10, survey_description_od11, survey_description_od12, survey_description_od13, survey_description_od14, survey_description_od15, survey_description_od16, survey_description_od17, survey_description_od18, survey_description_od19, survey_description_od20, survey_datestamp) VALUES('$survey_summary', '$survey_description[1]', '$survey_description[2]', '$survey_description[3]', '$survey_description[4]', '$survey_description[5]', '$survey_description[6]', '$survey_description[7]', '$survey_description[8]', '$survey_description[9]', '$survey_description[10]', '$survey_description[11]', '$survey_description[12]', '$survey_description[13]', '$survey_description[14]', '$survey_description[15]', '$survey_description[16]', '$survey_description[17]', '$survey_description[18]', '$survey_description[19]', '$survey_description[20]', '".time()."')");
Kliknij i zaczekaj na załadowanie kodu ...
I potrzebuję poprawić dwa SELEKTy w 30 i 109 lini w pliku student_survey.php, reszta kodu jest dobra :) Jak będę miał ten plik poprawny to z drugim sobie poradzę, tak myślę.
Połączony z 20 grudzień 2011 21:10:
Znalazłem błąd. Zly warunek wyjscia z pętli był. :) Wszystko się dodaje do bazy tylko prosił bym kogoś o pomoc z SELEKTami :)
zamiast
while ($check && $j < 21) {
if ($survey_description[$i] == "") {
$check = 0;
}
}
Kliknij i zaczekaj na załadowanie kodu ...
musi być
while ($check && $i < 21) {
if ($survey_description[$i] == "") {
$check = 0;
}
$i++;
}
Kliknij i zaczekaj na załadowanie kodu ...
Edytowane przez ELO320 dnia 20.12.2011 21:10:01
Wciśnij pomógł! To nie gryzie!
|