Announcements | Last Post | |
---|---|---|
SoC Curricula | 09/30/2017 01:08PM | |
Demarcation or scoping of examinations and assessment | 02/13/2017 07:59AM | |
School of Computing Short Learning Programmes | 11/24/2014 08:37AM | |
Unisa contact information | 07/28/2011 01:28PM |
linking table April 18, 2013 02:17AM |
Registered: 11 years ago Posts: 56 Rating: 0 |
Language: PHPMac. I think our tables must be linked like this. (Course_student.cid)=(course.cid) (Course_student.sno)=(student.sno) This is how I did on my tables but the problem is that I can not view ';sno'; from the table ';student'; on the table(course_student). Where must I check the errors.
Re: linking table April 18, 2013 08:19AM |
Registered: 11 years ago Posts: 163 Rating: 0 |
Re: linking table April 19, 2013 09:01AM |
Admin Registered: 18 years ago Posts: 10,001 Rating: 353 |
Re: linking table April 19, 2013 09:13AM |
Registered: 11 years ago Posts: 33 Rating: 0 |
Re: linking table May 01, 2013 01:27AM |
Registered: 11 years ago Posts: 56 Rating: 0 |
Re: linking table May 01, 2013 10:39AM |
Registered: 11 years ago Posts: 33 Rating: 0 |
Re: linking table May 01, 2013 02:09PM |
Registered: 11 years ago Posts: 34 Rating: 0 |
Re: linking table May 02, 2013 07:56AM |
Registered: 11 years ago Posts: 163 Rating: 0 |
Re: linking table May 05, 2013 11:00PM |
Registered: 11 years ago Posts: 34 Rating: 0 |
Re: linking table May 16, 2013 12:42PM |
Registered: 11 years ago Posts: 68 Rating: 0 |
Re: linking table May 16, 2013 02:16PM |
Registered: 11 years ago Posts: 167 Rating: 0 |
Language: PHPfunction getStudCrs($regStud){ conDB(); $sql = "SELECT b.cname FROM course_student a, course b WHERE a.sno = $regStud AND a.cid = b.cid ORDER BY b.cname"; $result = mysql_query($sql); while($selRows = mysql_fetch_array($result)){ echo $selRows[';cname';] . "<br>"; } mysql_close(); }
Re: linking table May 16, 2013 02:24PM |
Registered: 11 years ago Posts: 68 Rating: 0 |
Re: linking table May 16, 2013 04:47PM |
Registered: 11 years ago Posts: 167 Rating: 0 |
Re: linking table May 16, 2013 05:11PM |
Admin Registered: 18 years ago Posts: 10,001 Rating: 353 |
Language: PHPsql query to find a row { I have the row Using this info, create another sql query that targets another table- this query is run within the bracket of the first query, but has it owns brackets get the info } //close original bracket
Re: linking table May 17, 2013 08:33AM |
Registered: 11 years ago Posts: 163 Rating: 0 |
Language: PHPSELECT * FROM course_student WHERE cid = $courseid ORDER BY sno ASC .... while($studentrow = mysql_fetch_array($studentresult, MYSQL_ASSOC)) { $sno = $studentrow[';sno';]; SELECT * FROM student WHERE sno = $sno ..... from here you can get what ever info you want from a student table. }
Re: linking table May 17, 2013 11:19AM |
Registered: 11 years ago Posts: 68 Rating: 0 |
Language: PHP//========================= //INSERT DATA INTO DATABASE //========================= $sql = "INSERT INTO student(sname, init, fname, title, msname, dob, gen, lang, idno, telh, telw, cel, fax, email, address) VALUES (';$surname';, ';$initials';, ';$ffname';, ';$title';, ';$psurname';, ';$dob';, ';$gender';, ';$loc';, ';$idno';, ';$htel';, ';$wtel';, ';$cpnumber';, ';$fax';, ';$email';, ';$postadd';)"; $result = mysql_query($sql) or die (mysql_error()); //========================================= //GET AUTO INCREMENT FROM LAST INSERT TABLE //========================================= $student_id=mysql_insert_id(); $sql2 = "INSERT INTO course_student (sno, year) VALUES (';$student_id';, ';now()';"; $result2 = mysql_query($sql2) or die (mysql_error()); if (($result) && ($result2)) { echo "Registration successful."; } else { echo "There was a problem with the registration. Please try again"; } }
Re: linking table May 17, 2013 11:26AM |
Registered: 11 years ago Posts: 68 Rating: 0 |
Re: linking table May 17, 2013 12:41PM |
Registered: 11 years ago Posts: 163 Rating: 0 |
Re: linking table May 17, 2013 12:53PM |
Registered: 11 years ago Posts: 68 Rating: 0 |
Re: linking table May 20, 2013 08:58AM |
Admin Registered: 18 years ago Posts: 10,001 Rating: 353 |