Jump to content

tsuoshiro

Members
  • Posts

    13
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

tsuoshiro's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. hi...I would like to ask again, if you dont mind, like i said earlier (if you read my earlier post) i am generating a random questions.. i have a problem (again) on how to connect/combine the first random (test1) to the second random (test 2) questions.. its like combining/connecting/continuing the numbering of test 1 and test 2. for example, for the easy category, there are 30 questions... i will connect it to the average category (let us say it contains 20 items).. how can i connect it... hope my question is clear.. thanks again and hope you reply...
  2. Thank you so much... it works.. I would like to ask again, if you dont mind, like i said earlier i am generating a random questions.. i have a problem (again) on how to connect/combine the first random (test1) to the second random (test 2) questions.. its like combining/connecting/continuing the numbering of test 1 and test 2. for example, for the easy category, there are 30 questions... i will connect it to the average category (let us say it contains 20 items).. how can i connect it... hope my question is clear.. thanks again and hope you reply...
  3. I'm sorry if my question is not clear... Anyway my problem is that when i randomize my questions, i am generating a random of exam questions, there are no number beside it... for ex... what is php? a. program b.software c.food there is no number beside it like this.. 1.what is php? a. program b.software c.food hope this makes my questions clear... hope that you can help me...thanks again in advance
  4. Hi, i have a problem in numbering a random output... here is my code for the random process and output.. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <h3>Questions:</h3> <table width="610" border="0"> <tr> <td height="60"><table width="610" border="0"> <?php require_once("mysql_connect.php"); $course=$_POST['course']; $item=$_POST['item']; $level=$_POST['level']; if ($level=='easy') {$insert_level="1";} else if ($level=='average') {$insert_level = "2";} else {$insert_level="3";} mysql_select_db ("cpedb",$connection); $query = "SELECT * FROM `exam_question_mf` where `level`='$insert_level' AND `course`='$course' order by rand() limit $item"; $result=mysql_query($query,$connection) or die(mysql_error()); //$switch=true; while($row=mysql_fetch_array($result)) { ?> <tr> <th colspan="2" scope="col"><div align="left"><<?php echo $row['question']; ?></div></th> </tr> <tr> <td width="235"><?php echo "A. " . $row['choice_a']; ?></td> <td width="359"><?php echo "C. " . $row['choice_a']; ?></td> </tr> <tr> <td height="60"><?php echo "B. " . $row['choice_b']; ?> <p> </p></td> <td><?php echo "D. " . $row['choice_d']; ?> <p> </p></td> </tr> <?php } ?> </table></td> </tr> </table> </body> </html> Hope you can help me, i really need this for my project.. thank you in advance
  5. Thank you.. we will try the tutorial link that you gave us... thanks ^^
  6. Hello, i would like to ask for your help. I am creating a student profile program, and when i search for a name, all of the search results are viewed in one page.. how can i limit, for example 10 names per page where if you will click the next or the number 2 you can view the remaining pages just like when searching in google, in viewing the search results? I provided a picture for you to have an idea what my page look like and what the problem look like.... Hope that you can help me... thank in advance ^^
  7. Thanks !! No errors after that code... unfortunately... it doesnt UPDATE :'(... I just want to ask if the if (mysql_affected_rows()>0) { echo "Record is updated"; } else { echo ("Unable to update record"); } } will be the one who will confirm if an update occur? and also.. why does it not update.... is there something wrong with the codes or it is not connected it the database thats why it doesnt update?? sorry for asking so many questions... i really need your help... hope you help me again.. thanks in advance
  8. thanks for replying... after i remove the ";" another error occur " Parse error: parse error in C:\wamp\www\update ~orig~\update_student_process2.php on line 64" same filename..... i will show you the first program i made.. this is the first program i made, i separate it into 3 parts to make it easier ~i am doing a login system, w/ edit, delete, create a user, search a user and update.. i am halfway done but im stuck in the UPDATE part .. hope you can help me again... anyway this is the first program.. <?php class Database { var $config=Array(); var $link=""; function getConfig() { $config['dbhost']="localhost"; $config['dbuser']="root"; $config['dbpass']="change"; $config['dbname']="cpedb"; return $config; } function openDB() { $mydb=Database::getConfig(); // Connect to the database $link = mysql_connect($mydb['dbhost'], $mydb['dbuser'], $mydb['dbpass']) or die("Unable to connect to database"); mysql_select_db($mydb['dbname'],$link); return ($link); } function setQuery($sql) { return mysql_query($sql); } } function showSearch() { echo ("<form name='frm_search' action='updateupdatelive.php' method='post'>"); echo ("<input type='hidden' name='action' value='detail'>"); echo ("Student Number : <input type='text' name='student_number'><br>"); echo ("<input type='submit' name='f_submit' value='Search'>"); echo ("<input type='reset' name='f_submit' value='Reset'>"); echo ("</form>"); } function showRecord() { if (!$link=Database::openDB()){ exit("Unable to connect to the database"); } $sql="select * from student where student_number='".$_POST['student_number']."'"; $result=Database::setQuery($sql); $row=mysql_fetch_array($result); if (mysql_affected_rows()>0){ echo ("<form name='frm_details' action='updateupdatelive.php' method='post'>"); echo ("<input type='hidden' name='action' value='update'>"); echo ("Student Number : <input type='int' name='student_number' readonly value='".$row["student_number"]."'><br>"); echo ("Last Name : <input type='varchar' name='last_name' readonly value='".$row["last_name"]."'><br>"); echo ("First Name : <input type='varchar' name='first_name' readonly value='".$row["first_name"]."'><br>"); echo ("Middle Name : <input type='varchar' name='middle_name' readonly value='".$row["middle_name"]."' ><br>"); echo ("Year Level: <input type='varchar' name='year_level' value='".$row["year_level"]."'><br>"); echo ("Gender : <input type='text' name='gender' readonly value='".$row["gender"]."'><br>"); echo ("Birthday : <input type='text' name='birthday_month' readonly value='".$row["birthday_month"]."'>"); echo ("<input type='int' name='birthday_date' readonly value='".$row["birthday_day"]."'>"); echo ("<input type='int' name='birthday_year' readonly value='".$row["birthday_year"]."'><br>"); echo ("Age: <input type='int' name='age' value='".$row["age"]."'><br>"); echo ("Email : <input type='text' name='email' value='".$row["email"]."'><br>"); echo ("Student PhoneNumber : <input type='int' name='student_phone_number' value='".$row["student_phone_number"]."'><br>"); echo ("Student CellphoneNumber : <input type='int' name='student_cellphone_number' value='".$row["student_cellphone_number"]."'><br>"); echo ("Student Address : <input type='varchar' name='student_address' value='".$row["student_address"]."'><br>"); echo ("Student ProvincialAddress : <input type='varchar' name='student_provincial_address' value='".$row["student_provincial_address"]."'><br>"); echo ("Citizenship : <input type='text' name='citizenship' value='".$row["citizenship"]."'><br>"); echo ("Civil Status: <input type='text' name='civil_status'student_phone_number value='".$row["civil_status"]."'><br>"); echo ("Religion : <input type='text' name='religion' value='".$row["religion"]."'><br>"); echo ("Mother Name : <input type='text' name='mother_name' value='".$row["mother_name"]."'><br>"); echo ("Mother Occupation : <input type='text' name='mother_occupation' value='".$row["mother_occupation"]."'><br>"); echo ("Father Name : <input type='text' name='father_name' value='".$row["father_name"]."'><br>"); echo ("Father Occupation : <input type='text' name='father_occupation' value='".$row["father_occupation"]."'><br>"); echo ("Guardian Name : <input type='text' name='guardian_name' value='".$row["guardian_name"]."'><br>"); echo ("Guardian Relationship : <input type='text' name='guardian_relationship' value='".$row["guardian_relationship"]."'><br>"); echo ("Guardian ContactNumber : <input type='int' name='guardian_contact_number' value='".$row["guardian_contact_number"]."'><br>"); echo ("Guardian Address : <input type='varchar' name='guardian_address' value='".$row["guardian_address"]."'><br>"); echo ("<input type='submit' name='f_submit' value='Update'>"); echo ("</form>"); }else{ echo ("No record found"); } mysql_close($link); } function updateRecord() { $last_name=$_POST['last_name']; $first_name=$_POST['first_name']; $middle_name=$_POST['middle_name']; $student_number=$_POST['student_number']; $year_level=$_POST['year_level']; $gender=$_POST['gender']; $age=$_POST['age']; $email=$_POST['email']; $student_phone_number=$_POST['student_phone_number']; $student_cellphone_number=$_POST['student_cellphone_number']; $student_address=$_POST['student_address']; $student_provincial_address =$_POST['student_provincial_address']; $citizenship=$_POST['citizenship']; $civil_status=$_POST['civil_status']; $religion=$_POST['religion']; $mother_name=$_POST['mother_name']; $mother_occupation=$_POST['mother_occupation']; $father_name=$_POST['father_name']; $father_occupation=$_POST['father_occupation']; $guardian_name=$_POST['guardian_name']; $guardian_relationship=$_POST['guardian_relationship']; $guardian_contact_number =$_POST['guardian_contact_number']; $guardian_address=$_POST['guardian_address']; if (!$link=Database::openDB()){ exit("Unable to connect to the database"); } $sql="update student set " . " last_name = '$last_name'," . " middle_name = '$middle_name'," . " first_name = '$first_name'," . " year_level= '$year_level'," . " age= '$age'," . " email= '$email'," . " student_phone_number= '$student_phone_number'," . " gender= '$gender'," . " student_cellphone_number= '$student_cellphone_number'," . " student_address= '$student_address'," . " student_provincial_address = '$student_provincial_address '," . " citizenship= '$citizenship'," . " civil_status= '$civil_status'," . " religion= '$religion'," . " mother_name= '$mother_name'," . " mother_occupation= '$mother_occupation'," . " father_name= '$father_name'," . " father_occupation= '$father_occupation'," . " guardian_name= '$guardian_name'," . " guardian_relationship='$guardian_relationship'," . " guardian_contact_number = '$guardian_contact_number '," . " guardian_address= '$guardian_address',". " student_number= '$student_number'"; $result=Database::setQuery($sql); if (mysql_affected_rows()>0){ echo "Record is updated"; }else { echo ("Unable to update record"); } mysql_close($link); unset($_POST); ?> <?php } if (!$_POST){ showSearch(); } elseif ($_POST['action']=='detail'){ showRecord(); } elseif ($_POST['action']=='update'){ updateRecord(); } ?> this is the program again ~current program where the error occur " Parse error: parse error in C:\wamp\www\update ~orig~\update_student_process2.php on line 64" <?php $connection = mysql_connect("localhost", "root","change"); if (!$connection) {die("Database Connection failed!". mysql_error());} $db_select = mysql_select_db("cpedb",$connection); if(!$db_select) {die("Database Connection failed!". mysql_error());} ?> <?php $last_name=$_POST['last_name']; $first_name=$_POST['first_name']; $middle_name=$_POST['middle_name']; $year_level=$_POST['year_level']; $gender=$_POST['gender']; $age=$_POST['age']; $email=$_POST['email']; $student_phone_number=$_POST['student_phone_number']; $student_cellphone_number=$_POST['student_cellphone_number']; $student_address=$_POST['student_address']; $student_provincial_address=$_POST['student_provincial_address']; $citizenship=$_POST['citizenship']; $civil_status=$_POST['civil_status']; $religion=$_POST['religion']; $mother_name=$_POST['mother_name']; $mother_occupation=$_POST['mother_occupation']; $father_name=$_POST['father_name']; $father_occupation=$_POST['father_occupation']; $guardian_name=$_POST['guardian_name']; $guardian_relationship=$_POST['guardian_relationship']; $guardian_contact_number=$_POST['guardian_contact_number']; $guardian_address=$_POST['guardian_address']; $student_number=$_POST['student_number']; if (mysql_affected_rows()>0) { $result=mysql_query("UPDATE student set " . " last_name = '$last_name'," . " middle_name = '$middle_name'," . " first_name = '$first_name'," . " year_level= '$year_level'," . " gender= '$gender'," . " age= '$age'," . " email= '$email'," . " student_phone_number= '$student_phone_number'," . " student_cellphone_number= '$student_cellphone_number'," . " student_address= '$student_address'," . " student_provincial_address= '$student_provincial_address'," . " citizenship= '$citizenship'," . " civil_status= '$civil_status'," . " religion= '$religion'," . " mother_name= '$mother_name'," . " mother_occupation= '$mother_occupation'," . " father_name= '$father_name'," . " father_occupation= '$father_occupation'," . " guardian_name= '$guardian_name'," . " guardian_relationship='$guardian_relationship'," . " guardian_contact_number= '$guardian_contact_number'," . " guardian_address= '$guardian_address'". " WHERE student_number='$student_number'" ) if (mysql_affected_rows()>0) { echo "Record is updated"; } else { echo ("Unable to update record"); } } ?> <?php //Closing database mysql_close($connection); ?> do i need to edit it all or it can be fix by changing some codes in this part if the program??? thanks in advance... hope you can help me again
  9. Hello, i have a problem in my UPDATE program... At first it runs smoothly, when i will update it, there is a Parse error or "Parse error: parse error in C:\wamp\www\update ~orig~\update_student_process2.php on line 61" . Please, i really need your help. These are the the codes.. filename: update.php <form action='update_student_process.php' method='post'> <tbody> <tr> <td height="2" colspan="6" align="left" bgcolor="#FFFFFF"> </td> </tr> <tr> <td width="111" bgcolor="#FFFFFF"><pan class="style10">Student_Number</span></td> <input name="student_number" maxlength="7" size="10" type="text" id="student_number" /> </font></td> <td width="56"><input type="submit" name="Submit" id="button" value="Submit" /></td> <td width="56"><input type="reset" name="Reset" id="button" value="Reset" /></td> </tr> </table> </form> filename: update_student_process.PHP <?php $connection = mysql_connect("localhost", "root","change"); if (!$connection) {die("Database Connection failed!". mysql_error());} $db_select = mysql_select_db("cpedb",$connection); if(!$db_select) {die("Database Connection failed!". mysql_error());} ?> <?php $student_number; $student_number=$_POST['student_number']; //Perform database query if($student_number=$_POST['student_number']) { $result=mysql_query("SELECT * FROM student Where student_number ='$student_number' ",$connection); if(!$result) { die("Database Connection failed!". mysql_error()); } echo "<table border=0>"; $row=mysql_fetch_array($result); echo ("<form name='frm_details' action='update_student_process2.php' method='post'>"); echo ("<input type='hidden' name='action' value='update'>"); echo ("Student Number : <input type='text' name='student_number' readonly value='".$row["student_number"]."'><br>"); echo ("Last Name : <input type='text' name='last_name' readonly value='".$row["last_name"]."'><br>"); echo ("First Name : <input type='text' name='first_name' readonly value='".$row["first_name"]."'><br>"); echo ("Middle Name : <input type='text' name='middle_name' readonly value='".$row["middle_name"]."'><br>"); echo ("Year Level: <input type='text' name='year_level' value='".$row["year_level"]."'><br>"); echo ("Gender : <input type='text' name='gender' readonly value='".$row["gender"]."'><br>"); echo ("Birthday : <input type='text' name='birthday_month' readonly value='".$row["birthday_month"]."'>"); echo ("<input type='text' name='birthday_day' readonly value='".$row["birthday_day"]."'>"); echo ("<input type='text' name='birthday_year' readonly value='".$row["birthday_year"]."'><br>"); echo ("Age: <input type='text' name='age' value='".$row["age"]."'><br>"); echo ("Email : <input type='text' name='email' value='".$row["email"]."'><br>"); echo ("Student PhoneNumber : <input type='text' name='student_phone_number' value='".$row["student_phone_number"]."'><br>"); echo ("Student CellphoneNumber : <input type='text' name='student_cellphone_number' value='".$row["student_cellphone_number"]."'><br>"); echo ("Student Address : <input type='text' name='student_address' value='".$row["student_address"]."'><br>"); echo ("Student ProvincialAddress : <input type='text' name='student_provincial_address' value='".$row["student_provincial_address"]."'><br>"); echo ("Citizenship : <input type='text' name='citizenship' value='".$row["citizenship"]."'><br>"); echo ("Civil Status: <input type='text' name='civil_status' value='".$row["civil_status"]."'><br>"); echo ("Religion : <input type='text' name='religion' value='".$row["religion"]."'><br>"); echo ("Mother Name : <input type='text' name='mother_name' value='".$row["mother_name"]."'><br>"); echo ("Mother Occupation : <input type='text' name='mother_occupation' value='".$row["mother_occupation"]."'><br>"); echo ("Father Name : <input type='text' name='father_name' value='".$row["father_name"]."'><br>"); echo ("Father Occupation : <input type='text' name='father_occupation' value='".$row["father_occupation"]."'><br>"); echo ("Guardian Name : <input type='text' name='guardian_name' value='".$row["guardian_name"]."'><br>"); echo ("Guardian Relationship : <input type='text' name='guardian_relationship' value='".$row["guardian_relationship"]."'><br>"); echo ("Guardian ContactNumber : <input type='text' name='guardian_contact_number' value='".$row["guardian_contact_number"]."'><br>"); echo ("Guardian Address : <input type='text' name='guardian_address' value='".$row["guardian_address"]."'><br>"); echo ("<input type='submit' name='f_submit' value='Update'>"); echo ("</form>"); } ?> <?php //Closing database mysql_close($connection); ?> FILENAME: update_student_process2 ~this is where the error detected.. i dont know why there is a problem in the student number?? please help... this is the error again.... Parse error: parse error in C:\wamp\www\update ~orig~\update_student_process2.php on line 61 <?php $connection = mysql_connect("localhost", "root","change"); if (!$connection) {die("Database Connection failed!". mysql_error());} $db_select = mysql_select_db("cpedb",$connection); if(!$db_select) {die("Database Connection failed!". mysql_error());} ?> <?php $last_name=$_POST['last_name']; $first_name=$_POST['first_name']; $middle_name=$_POST['middle_name']; $year_level=$_POST['year_level']; $gender=$_POST['gender']; $age=$_POST['age']; $email=$_POST['email']; $student_phone_number=$_POST['student_phone_number']; $student_cellphone_number=$_POST['student_cellphone_number']; $student_address=$_POST['student_address']; $student_provincial_address=$_POST['student_provincial_address']; $citizenship=$_POST['citizenship']; $civil_status=$_POST['civil_status']; $religion=$_POST['religion']; $mother_name=$_POST['mother_name']; $mother_occupation=$_POST['mother_occupation']; $father_name=$_POST['father_name']; $father_occupation=$_POST['father_occupation']; $guardian_name=$_POST['guardian_name']; $guardian_relationship=$_POST['guardian_relationship']; $guardian_contact_number=$_POST['guardian_contact_number']; $guardian_address=$_POST['guardian_address']; $student_number=$_POST['student_number']; if (mysql_affected_rows()>0) { $result=mysql_query("UPDATE student set " . " last_name = '$last_name'," . " middle_name = '$middle_name'," . " first_name = '$first_name'," . " year_level= '$year_level'," . " gender= '$gender'," . " age= '$age'," . " email= '$email'," . " student_phone_number= '$student_phone_number'," . " student_cellphone_number= '$student_cellphone_number'," . " student_address= '$student_address'," . " student_provincial_address= '$student_provincial_address'," . " citizenship= '$citizenship'," . " civil_status= '$civil_status'," . " religion= '$religion'," . " mother_name= '$mother_name'," . " mother_occupation= '$mother_occupation'," . " father_name= '$father_name'," . " father_occupation= '$father_occupation'," . " guardian_name= '$guardian_name'," . " guardian_relationship='$guardian_relationship'," . " guardian_contact_number= '$guardian_contact_number'," . " guardian_address= '$guardian_address'". " WHERE student_number='$student_number'"; ) if (mysql_affected_rows()>0) { echo "Record is updated"; } else { echo ("Unable to update record"); } } ?> <?php //Closing database mysql_close($connection); ?> hope that you can help me. its my project for software subject... i just cant figure it out... thanks in advance
  10. Hello, i have a problem in my UPDATE program... At first it runs smoothly, when i will update it, there is a Parse error or "Parse error: parse error in C:\wamp\www\update ~orig~\update_student_process2.php on line 60" . Please, i really need your help. These are the the codes.. filename: update.php <form action='update_student_process.php' method='post'> <tbody> <tr> <td height="2" colspan="6" align="left" bgcolor="#FFFFFF"> </td> </tr> <tr> <td width="111" bgcolor="#FFFFFF"><pan class="style10">Student_Number</span></td> <input name="student_number" maxlength="7" size="10" type="text" id="student_number" /> </font></td> <td width="56"><input type="submit" name="Submit" id="button" value="Submit" /></td> <td width="56"><input type="reset" name="Reset" id="button" value="Reset" /></td> </tr> </table> </form> filename: update_student_process.PHP <?php $connection = mysql_connect("localhost", "root","change"); if (!$connection) {die("Database Connection failed!". mysql_error());} $db_select = mysql_select_db("cpedb",$connection); if(!$db_select) {die("Database Connection failed!". mysql_error());} ?> <?php $student_number; $student_number=$_POST['student_number']; //Perform database query if($student_number=$_POST['student_number']) { $result=mysql_query("SELECT * FROM student Where student_number ='$student_number' ",$connection); if(!$result) { die("Database Connection failed!". mysql_error()); } echo "<table border=0>"; $row=mysql_fetch_array($result); echo ("<form name='frm_details' action='update_student_process2.php' method='post'>"); echo ("<input type='hidden' name='action' value='update'>"); echo ("Student Number : <input type='text' name='student_number' readonly value='".$row["student_number"]."'><br>"); echo ("Last Name : <input type='text' name='last_name' readonly value='".$row["last_name"]."'><br>"); echo ("First Name : <input type='text' name='first_name' readonly value='".$row["first_name"]."'><br>"); echo ("Middle Name : <input type='text' name='middle_name' readonly value='".$row["middle_name"]."'><br>"); echo ("Year Level: <input type='text' name='year_level' value='".$row["year_level"]."'><br>"); echo ("Gender : <input type='text' name='gender' readonly value='".$row["gender"]."'><br>"); echo ("Birthday : <input type='text' name='birthday_month' readonly value='".$row["birthday_month"]."'>"); echo ("<input type='text' name='birthday_day' readonly value='".$row["birthday_day"]."'>"); echo ("<input type='text' name='birthday_year' readonly value='".$row["birthday_year"]."'><br>"); echo ("Age: <input type='text' name='age' value='".$row["age"]."'><br>"); echo ("Email : <input type='text' name='email' value='".$row["email"]."'><br>"); echo ("Student PhoneNumber : <input type='text' name='student_phone_number' value='".$row["student_phone_number"]."'><br>"); echo ("Student CellphoneNumber : <input type='text' name='student_cellphone_number' value='".$row["student_cellphone_number"]."'><br>"); echo ("Student Address : <input type='text' name='student_address' value='".$row["student_address"]."'><br>"); echo ("Student ProvincialAddress : <input type='text' name='student_provincial_address' value='".$row["student_provincial_address"]."'><br>"); echo ("Citizenship : <input type='text' name='citizenship' value='".$row["citizenship"]."'><br>"); echo ("Civil Status: <input type='text' name='civil_status' value='".$row["civil_status"]."'><br>"); echo ("Religion : <input type='text' name='religion' value='".$row["religion"]."'><br>"); echo ("Mother Name : <input type='text' name='mother_name' value='".$row["mother_name"]."'><br>"); echo ("Mother Occupation : <input type='text' name='mother_occupation' value='".$row["mother_occupation"]."'><br>"); echo ("Father Name : <input type='text' name='father_name' value='".$row["father_name"]."'><br>"); echo ("Father Occupation : <input type='text' name='father_occupation' value='".$row["father_occupation"]."'><br>"); echo ("Guardian Name : <input type='text' name='guardian_name' value='".$row["guardian_name"]."'><br>"); echo ("Guardian Relationship : <input type='text' name='guardian_relationship' value='".$row["guardian_relationship"]."'><br>"); echo ("Guardian ContactNumber : <input type='text' name='guardian_contact_number' value='".$row["guardian_contact_number"]."'><br>"); echo ("Guardian Address : <input type='text' name='guardian_address' value='".$row["guardian_address"]."'><br>"); echo ("<input type='submit' name='f_submit' value='Update'>"); echo ("</form>"); } ?> <?php //Closing database mysql_close($connection); ?> FILENAME: update_student_process2
  11. its my first time posting to a thread thats why i reposted it... sowwee if its not clear I have a problem in update profile. Whenever i update my first name and last name it is updatable, and when i add the middle name in the code the middle name doesnt search and updates the file. is it in the database or my code..can my codes can update only 2 ~the last name and first name~ please tell..thx in advance ^^ my first code for first name and last name ~working code~ <?php class Database { var $config=Array(); var $link=""; function getConfig() { $config['dbhost']="localhost"; $config['dbuser']="root"; $config['dbpass']="change"; $config['dbname']="studentsprofile"; return $config; } function openDB() { $mydb=Database::getConfig(); // Connect to the database $link = mysql_connect($mydb['dbhost'], $mydb['dbuser'], $mydb['dbpass']) or die("Unable to connect to database"); mysql_select_db($mydb['dbname'],$link); return ($link); } function setQuery($sql) { return mysql_query($sql); } } function showSearch() { echo ("<form name='frm_search' action='updateupdatelive.php' method='post'>"); echo ("<input type='hidden' name='action' value='detail'>"); echo ("Student Number : <input type='text' name='Student_Number'><br>"); echo ("<input type='submit' name='f_submit' value='Search'>"); echo ("<input type='reset' name='f_submit' value='Reset'>"); echo ("</form>"); } function showRecord() { if (!$link=Database::openDB()){ exit("Unable to connect to the database"); } $sql="select * from tblstudentsinformation where Student_Number='".$_POST['Student_Number']."'"; $result=Database::setQuery($sql); $row=mysql_fetch_array($result); if (mysql_affected_rows()>0){ echo ("<form name='frm_details' action='updateupdatelive.php' method='post'>"); echo ("<input type='hidden' name='action' value='update'>"); echo ("Student Number <input type='text' name='Student_Number' readonly value='".$row["Student_Number"]."'><br>"); echo ("Last Name : <input type='text' name='Last_Name' value='".$row["Last_Name"]."'><br>"); echo ("First Name : <input type='text' name='First_Name' value='".$row["First_Name"]."'><br>"); echo ("<input type='submit' name='f_submit' value='Update'>"); echo ("</form>"); }else{ echo ("No record found"); } mysql_close($link); } function updateRecord() { $Last_Name=$_POST['Last_Name']; $First_Name=$_POST['First_Name']; $Student_Number=$_POST['Student_Number']; if (!$link=Database::openDB()){ exit("Unable to connect to the database"); } $sql="update tblstudentsinformation set " . " Last_Name = '$Last_Name'," . " First_Name = '$First_Name' " . " where Student_Number='$Student_Number'"; $result=Database::setQuery($sql); if (mysql_affected_rows()>0){ echo "Record is updated"; }else { echo ("Unable to update record"); } mysql_close($link); unset($_POST); ?> <script language="javascript" type="text/javascript"> <!-- alert('Press a key to continue'); window.location = "./updateupdatelive.php" --> </script> <?php } if (!$_POST){ showSearch(); } elseif ($_POST['action']=='detail'){ showRecord(); } elseif ($_POST['action']=='update'){ updateRecord(); } ?> my code w/middle name ~no search found <---have problems whenever im adding middle name~ <?php class Database { var $config=Array(); var $link=""; function getConfig() { $config['dbhost']="localhost"; $config['dbuser']="root"; $config['dbpass']="change"; $config['dbname']="studentsprofile"; return $config; } function openDB() { $mydb=Database::getConfig(); // Connect to the database $link = mysql_connect($mydb['dbhost'], $mydb['dbuser'], $mydb['dbpass']) or die("Unable to connect to database"); mysql_select_db($mydb['dbname'],$link); return ($link); } function setQuery($sql) { return mysql_query($sql); } } function showSearch() { echo ("<form name='frm_search' action='updatedddddddddddd.php' method='post'>"); echo ("<input type='hidden' name='action' value='detail'>"); echo ("Student Number : <input type='text' name='Student_Number'><br>"); echo ("<input type='submit' name='f_submit' value='Search'>"); echo ("<input type='reset' name='f_submit' value='Reset'>"); echo ("</form>"); } function showRecord() { if (!$link=Database::openDB()){ exit("Unable to connect to the database"); } $sql="select * from tblstudentsinformation where Student_Number='".$_POST['Student_Number']."'"; $result=Database::setQuery($sql); $row=mysql_fetch_array($result); if (mysql_affected_rows()>2){ echo ("<form name='frm_details' action='updatedddddddddddd.php' method='post'>"); echo ("<input type='hidden' name='action' value='update'>"); echo ("Student Number <input type='text' name='Student_Number' readonly value='".$row["Student_Number"]."'><br>"); echo ("Last Name : <input type='text' name='Last_Name' value='".$row["Last_Name"]."'><br>"); echo ("Middle Name : <input type='text' name='Middle_Name' value='".$row["Middle_Name"]."'><br>"); echo ("First Name : <input type='text' name='First_Name' value='".$row["First_Name"]."'><br>"); echo ("<input type='submit' name='f_submit' value='Update'>"); echo ("</form>"); }else{ echo ("No record found"); } mysql_close($link); } function updateRecord() { $Last_Name=$_POST['Last_Name']; $Middle_Name=$_POST['Middle_Name']; $First_Name=$_POST['First_Name']; $Student_Number=$_POST['Student_Number']; if (!$link=Database::openDB()){ exit("Unable to connect to the database"); } $sql="update tblstudentsinformation set " . " Last_Name = '$Last_Name'," . " Middle_Name = '$Middle_Name' " . " First_Name = '$First_Name' " . " where Student_Number='$Student_Number'"; $result=Database::setQuery($sql); if (mysql_affected_rows()>2){ echo "Record is updated"; }else { echo ("Unable to update record"); } mysql_close($link); unset($_POST); ?> <script language="javascript" type="text/javascript"> <!-- alert('Press a key to continue'); window.location = "./updatedddddddddddd.php" --> </script> <?php } if (!$_POST){ showSearch(); } elseif ($_POST['action']=='detail'){ showRecord(); } elseif ($_POST['action']=='update'){ updateRecord(); } ?> hope u can help me.... thx again ^^
  12. ~sorry for reposting~ ~clear view of codes~ I have a problem in update profile. Whenever i update my first name and last name it is updatable, and when i add the middle name in the code the middle name doesnt search and updates the file. is it in the database or my code..can my codes can update only 2 ~the last name and first name~ please tell..thx in advance ^^ my first code for first name and last name ~working code~ <?php class Database { var $config=Array(); var $link=""; function getConfig() { $config['dbhost']="localhost"; $config['dbuser']="root"; $config['dbpass']="change"; $config['dbname']="studentsprofile"; return $config; } function openDB() { $mydb=Database::getConfig(); // Connect to the database $link = mysql_connect($mydb['dbhost'], $mydb['dbuser'], $mydb['dbpass']) or die("Unable to connect to database"); mysql_select_db($mydb['dbname'],$link); return ($link); } function setQuery($sql) { return mysql_query($sql); } } function showSearch() { echo ("<form name='frm_search' action='updateupdatelive.php' method='post'>"); echo ("<input type='hidden' name='action' value='detail'>"); echo ("Student Number : <input type='text' name='Student_Number'><br>"); echo ("<input type='submit' name='f_submit' value='Search'>"); echo ("<input type='reset' name='f_submit' value='Reset'>"); echo ("</form>"); } function showRecord() { if (!$link=Database::openDB()){ exit("Unable to connect to the database"); } $sql="select * from tblstudentsinformation where Student_Number='".$_POST['Student_Number']."'"; $result=Database::setQuery($sql); $row=mysql_fetch_array($result); if (mysql_affected_rows()>0){ echo ("<form name='frm_details' action='updateupdatelive.php' method='post'>"); echo ("<input type='hidden' name='action' value='update'>"); echo ("Student Number <input type='text' name='Student_Number' readonly value='".$row["Student_Number"]."'><br>"); echo ("Last Name : <input type='text' name='Last_Name' value='".$row["Last_Name"]."'><br>"); echo ("First Name : <input type='text' name='First_Name' value='".$row["First_Name"]."'><br>"); echo ("<input type='submit' name='f_submit' value='Update'>"); echo ("</form>"); }else{ echo ("No record found"); } mysql_close($link); } function updateRecord() { $Last_Name=$_POST['Last_Name']; $First_Name=$_POST['First_Name']; $Student_Number=$_POST['Student_Number']; if (!$link=Database::openDB()){ exit("Unable to connect to the database"); } $sql="update tblstudentsinformation set " . " Last_Name = '$Last_Name'," . " First_Name = '$First_Name' " . " where Student_Number='$Student_Number'"; $result=Database::setQuery($sql); if (mysql_affected_rows()>0){ echo "Record is updated"; }else { echo ("Unable to update record"); } mysql_close($link); unset($_POST); ?> <script language="javascript" type="text/javascript"> <!-- alert('Press a key to continue'); window.location = "./updateupdatelive.php" --> </script> <?php } if (!$_POST){ showSearch(); } elseif ($_POST['action']=='detail'){ showRecord(); } elseif ($_POST['action']=='update'){ updateRecord(); } ?> my code w/middle name ~no search found <---have problems whenever im adding middle name~ <?php class Database { var $config=Array(); var $link=""; function getConfig() { $config['dbhost']="localhost"; $config['dbuser']="root"; $config['dbpass']="change"; $config['dbname']="studentsprofile"; return $config; } function openDB() { $mydb=Database::getConfig(); // Connect to the database $link = mysql_connect($mydb['dbhost'], $mydb['dbuser'], $mydb['dbpass']) or die("Unable to connect to database"); mysql_select_db($mydb['dbname'],$link); return ($link); } function setQuery($sql) { return mysql_query($sql); } } function showSearch() { echo ("<form name='frm_search' action='updatedddddddddddd.php' method='post'>"); echo ("<input type='hidden' name='action' value='detail'>"); echo ("Student Number : <input type='text' name='Student_Number'><br>"); echo ("<input type='submit' name='f_submit' value='Search'>"); echo ("<input type='reset' name='f_submit' value='Reset'>"); echo ("</form>"); } function showRecord() { if (!$link=Database::openDB()){ exit("Unable to connect to the database"); } $sql="select * from tblstudentsinformation where Student_Number='".$_POST['Student_Number']."'"; $result=Database::setQuery($sql); $row=mysql_fetch_array($result); if (mysql_affected_rows()>2){ echo ("<form name='frm_details' action='updatedddddddddddd.php' method='post'>"); echo ("<input type='hidden' name='action' value='update'>"); echo ("Student Number <input type='text' name='Student_Number' readonly value='".$row["Student_Number"]."'><br>"); echo ("Last Name : <input type='text' name='Last_Name' value='".$row["Last_Name"]."'><br>"); echo ("Middle Name : <input type='text' name='Middle_Name' value='".$row["Middle_Name"]."'><br>"); echo ("First Name : <input type='text' name='First_Name' value='".$row["First_Name"]."'><br>"); echo ("<input type='submit' name='f_submit' value='Update'>"); echo ("</form>"); }else{ echo ("No record found"); } mysql_close($link); } function updateRecord() { $Last_Name=$_POST['Last_Name']; $Middle_Name=$_POST['Middle_Name']; $First_Name=$_POST['First_Name']; $Student_Number=$_POST['Student_Number']; if (!$link=Database::openDB()){ exit("Unable to connect to the database"); } $sql="update tblstudentsinformation set " . " Last_Name = '$Last_Name'," . " Middle_Name = '$Middle_Name' " . " First_Name = '$First_Name' " . " where Student_Number='$Student_Number'"; $result=Database::setQuery($sql); if (mysql_affected_rows()>2){ echo "Record is updated"; }else { echo ("Unable to update record"); } mysql_close($link); unset($_POST); ?> <script language="javascript" type="text/javascript"> <!-- alert('Press a key to continue'); window.location = "./updatedddddddddddd.php" --> </script> <?php } if (!$_POST){ showSearch(); } elseif ($_POST['action']=='detail'){ showRecord(); } elseif ($_POST['action']=='update'){ updateRecord(); } ?> hope u can help me.... thx again ^^
  13. I have a problem in update profile. Whenever i update my first name and last name it is updatable, and when i add the middle name in the code the middle name doesnt search and updates the file. is it in the database or my code..can my codes can update only 2 ~the last name and first name~ please tell..thx in advance ^^ my first code for first name and last name ~working code~ <?php class Database { var $config=Array(); var $link=""; function getConfig() { $config['dbhost']="localhost"; $config['dbuser']="root"; $config['dbpass']="change"; $config['dbname']="studentsprofile"; return $config; } function openDB() { $mydb=Database::getConfig(); // Connect to the database $link = mysql_connect($mydb['dbhost'], $mydb['dbuser'], $mydb['dbpass']) or die("Unable to connect to database"); mysql_select_db($mydb['dbname'],$link); return ($link); } function setQuery($sql) { return mysql_query($sql); } } function showSearch() { echo ("<form name='frm_search' action='updateupdatelive.php' method='post'>"); echo ("<input type='hidden' name='action' value='detail'>"); echo ("Student Number : <input type='text' name='Student_Number'><br>"); echo ("<input type='submit' name='f_submit' value='Search'>"); echo ("<input type='reset' name='f_submit' value='Reset'>"); echo ("</form>"); } function showRecord() { if (!$link=Database::openDB()){ exit("Unable to connect to the database"); } $sql="select * from tblstudentsinformation where Student_Number='".$_POST['Student_Number']."'"; $result=Database::setQuery($sql); $row=mysql_fetch_array($result); if (mysql_affected_rows()>0){ echo ("<form name='frm_details' action='updateupdatelive.php' method='post'>"); echo ("<input type='hidden' name='action' value='update'>"); echo ("Student Number <input type='text' name='Student_Number' readonly value='".$row["Student_Number"]."'><br>"); echo ("Last Name : <input type='text' name='Last_Name' value='".$row["Last_Name"]."'><br>"); echo ("First Name : <input type='text' name='First_Name' value='".$row["First_Name"]."'><br>"); echo ("<input type='submit' name='f_submit' value='Update'>"); echo ("</form>"); }else{ echo ("No record found"); } mysql_close($link); } function updateRecord() { $Last_Name=$_POST['Last_Name']; $First_Name=$_POST['First_Name']; $Student_Number=$_POST['Student_Number']; if (!$link=Database::openDB()){ exit("Unable to connect to the database"); } $sql="update tblstudentsinformation set " . " Last_Name = '$Last_Name'," . " First_Name = '$First_Name' " . " where Student_Number='$Student_Number'"; $result=Database::setQuery($sql); if (mysql_affected_rows()>0){ echo "Record is updated"; }else { echo ("Unable to update record"); } mysql_close($link); unset($_POST); ?> <script language="javascript" type="text/javascript"> <!-- alert('Press a key to continue'); window.location = "./updateupdatelive.php" --> </script> <?php } if (!$_POST){ showSearch(); } elseif ($_POST['action']=='detail'){ showRecord(); } elseif ($_POST['action']=='update'){ updateRecord(); } ?> my code w/middle name ~no search found <---have problems whenever im adding middle name~ <?php class Database { var $config=Array(); var $link=""; function getConfig() { $config['dbhost']="localhost"; $config['dbuser']="root"; $config['dbpass']="change"; $config['dbname']="studentsprofile"; return $config; } function openDB() { $mydb=Database::getConfig(); // Connect to the database $link = mysql_connect($mydb['dbhost'], $mydb['dbuser'], $mydb['dbpass']) or die("Unable to connect to database"); mysql_select_db($mydb['dbname'],$link); return ($link); } function setQuery($sql) { return mysql_query($sql); } } function showSearch() { echo ("<form name='frm_search' action='updatedddddddddddd.php' method='post'>"); echo ("<input type='hidden' name='action' value='detail'>"); echo ("Student Number : <input type='text' name='Student_Number'><br>"); echo ("<input type='submit' name='f_submit' value='Search'>"); echo ("<input type='reset' name='f_submit' value='Reset'>"); echo ("</form>"); } function showRecord() { if (!$link=Database::openDB()){ exit("Unable to connect to the database"); } $sql="select * from tblstudentsinformation where Student_Number='".$_POST['Student_Number']."'"; $result=Database::setQuery($sql); $row=mysql_fetch_array($result); if (mysql_affected_rows()>2){ echo ("<form name='frm_details' action='updatedddddddddddd.php' method='post'>"); echo ("<input type='hidden' name='action' value='update'>"); echo ("Student Number <input type='text' name='Student_Number' readonly value='".$row["Student_Number"]."'><br>"); echo ("Last Name : <input type='text' name='Last_Name' value='".$row["Last_Name"]."'><br>"); echo ("Middle Name : <input type='text' name='Middle_Name' value='".$row["Middle_Name"]."'><br>"); echo ("First Name : <input type='text' name='First_Name' value='".$row["First_Name"]."'><br>"); echo ("<input type='submit' name='f_submit' value='Update'>"); echo ("</form>"); }else{ echo ("No record found"); } mysql_close($link); } function updateRecord() { $Last_Name=$_POST['Last_Name']; $Middle_Name=$_POST['Middle_Name']; $First_Name=$_POST['First_Name']; $Student_Number=$_POST['Student_Number']; if (!$link=Database::openDB()){ exit("Unable to connect to the database"); } $sql="update tblstudentsinformation set " . " Last_Name = '$Last_Name'," . " Middle_Name = '$Middle_Name' " . " First_Name = '$First_Name' " . " where Student_Number='$Student_Number'"; $result=Database::setQuery($sql); if (mysql_affected_rows()>2){ echo "Record is updated"; }else { echo ("Unable to update record"); } mysql_close($link); unset($_POST); ?> <script language="javascript" type="text/javascript"> <!-- alert('Press a key to continue'); window.location = "./updatedddddddddddd.php" --> </script> <?php } if (!$_POST){ showSearch(); } elseif ($_POST['action']=='detail'){ showRecord(); } elseif ($_POST['action']=='update'){ updateRecord(); } ?> hope u can help me.... thx again ^^
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.