Welcome! Log In Create A New Profile

Advanced

New prac thread

Posted by Mac 
Announcements Last Post
Announcement SoC Curricula 09/30/2017 01:08PM
Announcement Demarcation or scoping of examinations and assessment 02/13/2017 07:59AM
Announcement School of Computing Short Learning Programmes 11/24/2014 08:37AM
Announcement Unisa contact information 07/28/2011 01:28PM
Re: New prac thread
June 05, 2006 12:48PM
I spent the last two days doing validation and making my site more secure :-(.

Murphy's Technology Law 7
-- The attention span of a computer
is only as long as its electrical cord.
Re: New prac thread
June 06, 2006 02:22PM
What's the best way to prevent students from signing up for the same course more than once, validating the data as it goes in, or selecting the data from course_student only once?
Re: New prac thread
June 06, 2006 04:40PM
Hi Libby.

A bit of both..I guess.

Before a student registers, you could check the student_course table to see if they have already registered for that course.

if not, the data can then go into the table.


Murphy's Technology Law 7
-- The attention span of a computer
is only as long as its electrical cord.
Re: New prac thread
June 06, 2006 06:14PM
I have tried various things without success. I have also tried googling but am obviously using the wrong jargon. Would I be right In saying I need to SELECT from the student_course table and then use if else statements?
avatar
Mac
Re: New prac thread
June 06, 2006 08:16PM
Libby - I posted a solution in an early port as how to handle this?
Re: New prac thread
June 06, 2006 08:53PM
Mac,
As far as I can see you replied "You can add if if you want - a simple select to check for personal details before inserting the student details into the db will do. But we assume a once-off registration system here, so it is not required." in a response to the query about duplicating student registrations.

This is a slightly different issue - about not inserting duplicate data into course_student - unless I'm missing some other post. I'm happy to google for it but I'd appreciate the correct jargon. I've looked an array_unique,INSERT IGNORE etc etc but I'm not finding anything that is really helpful.



Re: New prac thread
June 06, 2006 09:28PM
It seems every time I want to post a question, it was already asked and answered. grinning smiley Like the one on duplicate student records..
Re: New prac thread
June 07, 2006 09:45AM
Hi all
If any of you are having a similar problem to me with registrations being duplicated, I burnt some midnight oil and I discovered that the following does the trick:
a select query where sno AND cid are checked and then using mysql_num_rows to check whether a row like than exists, followed by a if else statement.

I found a most helpful site here:
http://www.php-editors.com/
avatar
Mac
Re: New prac thread
June 08, 2006 08:16AM
A previous post:

the mysql_num_rows function counts the number of rows that exist depending on your select query. So "SELECT * FROM TABLE.." will count or the rows in the table. Adding a WHERE statement to the query will count the rows that fit the WHERE clause.

$query = "SELECT this FROM that_table WHERE that='$that'";

$result = mysql_query($query, $connection) or
die ("<p class=err>Error - Query failed: ".mysql_error().""winking smiley;

$num_rows = mysql_num_rows($result);

Then you can use $num_rows (or whatever you decided to call it) however you want to use it, e.g.

if($num_rows > 1000) { echo "sorry, you can't register for this course since it is full"; //1000 students have already registered }
Re: New prac thread
June 12, 2006 08:41AM
I have completed the project. When will we be able to upload it to server?
Sorry, you do not have permission to post/reply in this forum.