954,180 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

help in php regstration

hello

i am a very biggner in php but i have to do a homework about student regstration module

there is 4 groups and 32 student ,each groupe should have 8 students

when a student would be register in a groupe
should i check if he is alredy exist in the database, if he so should i display a page and tell him u r already exist,do u want to change your groupe and display the form to select a groupe from it

and if he not exist in database but select a groupe is full, a page should be displayed with the groupes are not fully

how should i do this???????????????????????

i am trying to solve it but i cant i am little in php

hope u help me


i write this code

<?php include_once("Connection.php");
?>


<?php ConnectToDatabase ();

if (isset($_POST['submit'])){
if (empty($_POST['name'])){
echo 'please fill all fields';
}
else {
$name=$_POST['box1'];
$id=$_POST['box2'];
$email=$_POST['box3'];
$grp=$_GET['time'];
for($i=0;$i<4;$i++)
if($grp[i])
$query = "select groupeNum from groupes
where time=$grp;

$query1 ="INSERT INTO studentsgroup VALUES ('$name', '$id', '$email', 'groupeNum')";
$result = mysql_query($query1,$student);

$checkstu = "SELECT count(*) FROM studentsgroup
WHERE SID=$id;

$check = mysql_query($checkstu, $student);
$result1 = mysql_fetch_row($check);
$result1 = $result1['0'];

if($result1 >0) {
//here shold be a link to another page includes something like:
//you are already register do you want to change your group?
//and there are to buttons when clik yes should be displayed all groups and
//select from thier and also check if this groupe is full or not

}
else {
$insertstudent="INSERT INTO studentsgroup VALUES ('$name', '$id', '$email', 'groupeNum')";
$write = mysql_query($insertstudent,$student);

?>


and the database is student
have 2 tables
groupes(groupNum, lecturer,password,time)
studentsgroup(groupNum,SID,groupName,email)

toleen
Newbie Poster
4 posts since Jan 2010
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You