Jump to content

Recommended Posts

guys,

 

i need help i have a page

that displays the total number of items on each column

 

my problem now, when i do some updates, the result is not being reflected to the form

its kinda hard to explain, but below is my process page

and i will just tell you want i wanted to happen on this page

<?php
session_start();

if (session_is_registered("username")){
}else{
echo "<font face=\"Arial\">You are not authorized to access this page ... Please <a href='index.php'>Login</a></font>";
}

include '../db_connect.php';

$astatus = $_POST['astatus'];
$ajid = $_POST['ajid'];
$appid = $_POST['appid'];
$jobid = $_POST['jobid'];

//foreach($checkbo as $key=>$val){
//print "$key".$val;
if ($astatus == 'Not Considered'){
$sql1="UPDATE job_ads SET nconsidered = nconsidered - 1 WHERE jobid= '$jobid'";
	mysql_query($sql1) or die("error:".mysql_error());

$sql6="UPDATE job_ads SET nconsidered = nconsidered + 1 WHERE jobid= '$jobid'";
mysql_query($sql6) or die("error:".mysql_error());
}
elseif
($astatus = 'Considered'){
$sql2="UPDATE job_ads SET considered = considered - 1 WHERE jobid= '$jobid'";
	mysql_query($sql2) or die("error:".mysql_error());

 $sql7="UPDATE job_ads SET considered = considered + 1 WHERE jobid= '$jobid'";
 mysql_query($sql7) or die("error:".mysql_error());
}
elseif
($astatus = 'Scheduled'){
$sql3="UPDATE job_ads SET scheduled = scheduled - 1 WHERE jobid= '$jobid'";
	mysql_query($sql3) or die("error:".mysql_error());

$sql8="UPDATE job_ads SET scheduled = scheduled + 1 WHERE jobid= '$jobid'";
mysql_query($sql8) or die("error:".mysql_error());
}
elseif
($astatus = 'Interviewed'){
$sql4="UPDATE job_ads SET interviewed = interviewed - 1 WHERE jobid= '$jobid'";
	mysql_query($sql4) or die("error:".mysql_error());

$sql9="UPDATE job_ads SET interviewed = interviewed + 1 WHERE jobid= '$jobid'";
mysql_query($sql9) or die("error:".mysql_error());
}
elseif
($astatus = 'Blacklisted'){
$sql5="UPDATE job_ads SET blocked = blocked - 1 WHERE jobid= '$jobid'";
	mysql_query($sql5) or die("error:".mysql_error());

$sql10="UPDATE job_ads SET blocked = blocked + 1 WHERE jobid= '$jobid'";
mysql_query($sql10) or die("error:".mysql_error());
}

$sql="UPDATE applicantjob SET a_status = '$astatus' WHERE ajid= '$ajid'";
	mysql_query($sql) or die("error:".mysql_error());

   echo '<script language=javascript> alert("job application has been updated!");top.location = "details.php?id=1&appid='.$appid.'&ajid='.$ajid.'";</script>';
?>

 

 

normally, i have a "astatus" radio button in my first page

with values

Not Considered

Considered

Scheduled

Interviewed

Blacklisted

 

so on that page when i update

let say the current value is "blacklisted"

if i update it and change it to "considered"

 

and value of "1" should be added to the field of

"considered" field in my job_ads table

and it will subtract "1" from "blocked" field in my job_ads table.

 

same goes with the other conditions

 

what is happening now in my current codes is,

its not working and the vaules are still the same

or hasnt changed at all

 

hope you could help me with this

 

thanks so much!!!!!

Link to comment
https://forums.phpfreaks.com/topic/42647-need-help-on-my-update-form/
Share on other sites

I'm not sure, but I didn't think you could do:

 

UPDATE job_ads SET nconsidered = nconsidered + 1 WHERE jobid= '$jobid'"

 

in sql. Maybe this would work:

 

UPDATE job_ads SET nconsidered = (SELECT nconsidered+1  FROM job_ads WHERE jobid= '$jobid') WHERE jobid= '$jobid'"

 

if this don't work, just run two sql commands, one to select the val, then one to set the val.

monk.e.boy

hi,

 

no, its not working.

 

the last sql query that i have

$sql="UPDATE applicantjob SET a_status = '$astatus' WHERE ajid= '$ajid'";

mysql_query($sql) or die("error:".mysql_error());

 

is working but the rest of the sql queries are not working

 

maybe there just something wong with my if else conditions

or maybe with my queries

 

need help please

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.