Jump to content

dapcigar

Members
  • Posts

    58
  • Joined

  • Last visited

Everything posted by dapcigar

  1. I want to subtract a value from a table and update it with the new value. i don't get the desired result everytime i do it. please what am i doing wrong? <?php $id = $_GET['id']; ?> <?php include('mysql_connect.php'); // select departnemt $sql1 = mysql_query("SELECT * FROM requisition WHERE id = '$id' "); $dept = mysql_fetch_array($sql1); $amount = $dept ['amount']; $department = $dept['department']; // select the budget DB $sql2 = mysql_query("SELECT * FROM budget WHERE department = '$department' "); $budget = mysql_fetch_array($sql1); $actual = $budget['actual'] ; $final = ($actual - $amount); $r = mysql_query("UPDATE budget SET actual = '$final' WHERE department = '$department'") or die(mysql_error()); $q = mysql_query("UPDATE requisition SET status = 'Paid' WHERE id = '$id'") or die(mysql_error()); header("Location: approved_req.php"); ?> thanks in advance
  2. i want my login page to redirect to different pages depending on the id provided.. the code below.. include('mysql_connect.php'); $sql = mysql_query("SELECT * FROM users WHERE username='$username' AND password='$password' LIMIT 1"); if(mysql_num_rows($sql) == 1){ $row = mysql_fetch_array($sql); session_start(); $_SESSION['username'] = $row['username']; $_SESSION['firstname'] = $row['firstname']; $_SESSION['lastname'] = $row['lastname']; $_SESSION['department'] = $row['department']; $_SESSION['logged'] = TRUE; if ($position == "Admin") { header("Location: admin/Admin_dash.php"); exit; } if ($position == "HOD" && $department == "Account") { header("Location: hod/hod_dash.php"); exit; } else { header("Location: staff/staff_dash.php"); exit; } Please, how can i retrieve the position from the DB and use it to run an IF statement?
  3. Please, how do i generate a graph from the data i have in my DB? thanks in advance
  4. i solved it.. i created two separate links and use the id to update the data
  5. Yeah, that is exactly what i want to do. i just got confused and don't know where to go from there..
  6. Here is the issue.. i have this particular code getting data from the DB... <?php include('mysql_connect.php'); $query1 = mysql_query ("select * from requisition where username = '$user' ") or die(mysql_error()); // $result= mysql_query($query1) ; echo " <thead> <tr> <th>ID</th> <th>Category</th> <th>Description</th> <th>Status</th> </tr> </thead> <tbody>"; while($row = mysql_fetch_array($query1)) { echo"<tr>"; echo"<td> $row[id]</td>"; echo"<td> $row[category]</td>"; echo"<td> $row[description]</td>"; echo"<td> $row[status]</td>"; echo"</tr>"; } echo"</table>"; echo"</table>"; echo"<div align=center>"; echo"<br>"; echo"</div>"; .................................................... Now i want to include something like this to control the data in each row <td class="center"><span class="label label-success">Approved</span></td> <td class="center"> <a class="btn btn-info" href="#"> <i class="icon-edit icon-white"></i> Approve </a> <a class="btn btn-danger" href="#"> <i class="icon-trash icon-white"></i> Deny </td>
  7. i want to add two different actions to each row. for example, i want to be able to approve or deny the report on each row. i want the approve and deny icon to update every row in the database.. Yea, am a newbie.. if you could please give me a syntax that could make this work, i woud appreciate it.. Thanks in advance
×
×
  • 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.