Jump to content

jpergega

Members
  • Posts

    33
  • Joined

  • Last visited

Everything posted by jpergega

  1. Hi I have a system that has two different types of users staff and student. If I logged in as a staff I can search an existing students':(username, firstname and surname) then I want to copying the search result(a selected existing student account detail by click a button) into another database table. Right now both users' details are store in one table called userAccount and there is a permission field in the table to distinguish the two. My question is if I logged in as a staff and I want to copy a student's detail into another table in the mysql What do I need to change and add in that new table then? Many thanks
  2. Thanks for the reply Right now the problem is: Error:Cannot add or update a child row: a foreign key constraint fails because I logged in as a staff account and I am copying an existing student account detail into another table what do I need to change in the database table then? Right now both users' details are store in one table called userAccount and there is permission setting in the table to distinguish the two. Thanks
  3. Hi I have two different types of users one is student the other is staff. Right now in the staff account the staff can search student from the database. What I want to do is that when the search result returns the staff can click on the add button to store copy of this student's data to another database table. Right now I am not able to add copy of the student record into another table because: 1.there is the foreign key constraint 2.I know the code in the data.php(see below) is incorrect. I would grateful if you could point out what I need to do? Thanks Here is the code in the Staff Account; <?php if(isset($_POST['find'])){ if(empty($_POST['find'])){ $nameErr = "Missing";} else{ //$find = $_POST['find']; $results=getStudent(); echo "<table> <tr> <th>Username</th> <th>First Name</th> <th>Surname</th> </tr>"; while ($row = mysql_fetch_array($results)){ echo "<tr>"; echo "<form action=data.php method=post>"; echo "<td>" .$row['username']."</td>"; echo "<td>".$row['firstname']."</td>"; echo "<td>".$row['surname']."</td>"; echo "<input id=addS name=adds type=submit/></form></td>"; echo "<tr/>"; } echo"</table>"; } } ?> Here is the code in the data.php <?php if(isset($_POST['adds'])){ $_row['username'] = $_POST['username']; $_row['firstname'] = $_POST['firstname'] ; $_row['surname'] = $_POST['surname'] ; //inserting data order $order = "INSERT INTO studentgroup (username,firstname,surname) VALUES ('$_POST[username]', '$_POST[firstname]','$_POST[surname]')"; $result = "select * from studentgroup"; if(!mysqli_query($con,$order)){ die('Error:'. mysqli_error($con)); } header ("Location: staffAccount.php"); } } ?>
  4. Hi I am trying to create an alert box to connect to one of mysql table and the field is called "Finish", data type is Date. When a task is expired I would like to have a popup message to alert the user to say the task is expired. Here is the code which I am not able to get it to work is given me an error message, that is the code in red bold. I would be really grateful if someone can tell me what I'm doing wrong here please? Thanks ( ! ) Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in C:wampwwwScholarGoalTrackerstudentAccount.php on line 96 <?php $curdate = date('m/d/y'); $query4 = 'select finish from task WHERE account_id =$account_id"'; $result4= mysqli_query($con, $query4); while($row = mysqli_fetch_array($result4)){ if($row['finish'] == $curdate) { echo '<script language="javascript">alert("Your task had been expired.")</script>'; } } ?>
  5. Hi I am trying to echo mysql data to a progress bar but I am not sure how to do this. I have tried the following but obviously is wrong. Could you please help? <td><progress value='<?php echo $row['progress'];?>'</progress></td> Thanks
×
×
  • Create New...