Need help, displaying database content not working
Posted: Mon Sep 22, 2008 12:20 am
hi all,
im making a program in which a student could view the subject curriculum with his decided curriculum year,...I've created a new table named curr_subjs with the ff fields:
now, if the admin created a new curriculum, the name(for example, The New Curriculum) of that curriculum will be stored in curr_names.When he add new subjects, those subjects will be stored in curr_subjs but the value for subj_curr field will be the modified one(thenewcurriculum).
the code is working properly...
but i have a situation which i cant handle regarding on retrieving the data from the table curr_subjs. The code returns no error, but ain't working
on the admin page, there's an option to view the added curriculum, here's the code
Upon selecting his decided curriculum he want to view, the page will bring him to viewcurr.php
get the id of the selected curriculum, and returns the unmodified name(The New Curriculum), and modify it with the $strippedCurrName variable so the name now will be (thenewcurriculum).
and on the result section
again, the code did not return any error, but not functioning...
Please help me solve this....Many thanks in advance and God bless us always...
im making a program in which a student could view the subject curriculum with his decided curriculum year,...I've created a new table named curr_subjs with the ff fields:
Code: Select all
id INT
subj_code VARCHAR,
subj_desc VARCHAR,
lec_hrs INT,
lab_hrs INT,
subj_units INT,
subj_preq VARCHAR,
subj_sem INT,
subj_level INT
subj_curr VARCHAR
the code is working properly...
but i have a situation which i cant handle regarding on retrieving the data from the table curr_subjs. The code returns no error, but ain't working
on the admin page, there's an option to view the added curriculum, here's the code
Code: Select all
include_once 'conn.php';
$getCurriculum = "SELECT * FROM curr_names";
$getCurriculumNow = mysql_query($getCurriculum);
while($crclm = mysql_fetch_array($getCurriculumNow)){
print<<<HERE
<tr>
<td width="493" height="27" valign="middle" style="background:#ffffff; color:#333333; padding-left: 10px;">$crclm[currname]</td>
<td width="80" valign="middle" style="background:#ffffff; color:#333333; padding-left: 10px;">$crclm[currcourse]</td>
<td width="71" valign="middle"><form name="form2" method="post" action="[color=#80FF00]viewcurr.php?mode=View&viewCurrIs=[/color][color=#800000]$crclm[/color][color=#40FF00][id][/color]"><input type="submit" class="qpost_button" name="LetsViewCurr" value="View" /></form></td>
</tr>
HERE;
}
Code: Select all
//on the top of the page
if(!isset($_SESSION)){
session_start();
}
if ($_REQUEST['mode'] == "View") {
include_once '../admin_/conn.php';
if ($_GET['id']) {
$id = (int)$_GET['id'];
$getCurriculumNow = mysql_query("SELECT currname FROM curr_names WHERE id = '$id'");
$strippedCurrName = strtolower(strip_tags(str_replace(' ', '', $getCurriculumNow)));
echo ($getCurriculumNow." and ".$strippedCurrName) ;
}
}
and on the result section
Code: Select all
[color=#800000]$GetSubjsF[/color] = "SELECT * FROM curr_subjs WHERE subj_curr = '$strippedCurrName' AND subj_level = 1 AND subj_desc != '' AND subj_sem = 1";
[color=#400000]$GetSubjsNowF[/color] = mysql_query([color=#800000]$GetSubjsF[/color]);
while ($subjSecondSemView = mysql_fetch_array($GetSubjsNowS)) {
echo "$subjSecondSemView[subj_code] ";
echo "$subjSecondSemView[subj_desc] ";
echo "$subjSecondSemView[lec_hrs] ";
echo "$subjSecondSemView[lab_hrs] ";
echo "$subjSecondSemView[subj_units] ";
echo "$subjSecondSemView[subj_preq]";
}
again, the code did not return any error, but not functioning...
Please help me solve this....Many thanks in advance and God bless us always...