Jump to content

Can anyone spot the error?


DBookatay

Recommended Posts

Hi Freaks!

 

I have a page with (technically) 3 forms on the same page, I say technically because of which "forms_view.php?body=________" you are on determines which form you are actually seeing.

 

For some reason I can only get 2 out of the 3 post querys to function, and I've tried EVERYTHING...

Moving the order of them around, moving them to different locations on the page, renaming the querys, everything, still the last one (query3) will not work...

 

Can anyone spot the error?

if (isset($_POST['edit'])){
$query = "UPDATE EZFinancing_Apps SET
status = '{$_POST['status']}',
apScore = '{$_POST['apScore']}',
coapScore = '{$_POST['coapScore']}',
Citi = '{$_POST['Citi']}',
AL = '{$_POST['AL']}',
UCF = '{$_POST['UCF']}'
where id = '$id'"; 
if ($result = mysql_query ($query)) {header('Location: forms_view.php?id=' . $id );}


if ($_POST['cmnts']){
$post_comments = addslashes(escape_data($_POST['cmnts']));
$query2 = "INSERT INTO EZFinancing_Notes SET
App_id = '$id',
comments = '$post_comments',
posted = NOW()"; }
if ($result = mysql_query ($query2)) {header('Location: forms_view.php?id='.$id.'&body=Notes');}


if ($_POST['vehYear']){
$query3 = "INSERT INTO EZFinancing_Figures SET
App_id = '$id',
year = '{$_POST['year']}',
make = '{$_POST['make']}',
model = '{$_POST['model']}',
A = '{$_POST['A']}',
B = '{$_POST['B']}',
C = '{$_POST['C']}',
D = '{$_POST['D']}',
E = '{$_POST['E']}',
F = '{$_POST['F']}',
G = '{$_POST['G']}',
H = '{$_POST['H']}',
I = '{$_POST['I']}',
J = '{$_POST['J']}',
K = '{$_POST['K']}',
L = '{$_POST['L']}',
M = '{$_POST['M']}',
O = '{$_POST['O']}',
1 = '{$_POST['1']}',
2 = '{$_POST['2']}',
amtFin = '{$_POST['amtFin']}',
finChrg = '{$_POST['finChrg']}',
totalPymts = '{$_POST['totalPymts']}',
totalPrce = '{$_POST['totalPrce']}',
finRsrve = '{$_POST['finRsrve']}',
price = '{$_POST['price']}',
weekly = '{$_POST['weekly']}',
monthly = '{$_POST['monthly']}'"; }
if ($result = mysql_query ($query3)) {header('Location: forms_view.php?id='.$id.'&body=Notes');} else {echo mysql_error();}

Link to comment
Share on other sites

Your insert SQL is incorrect. It should follow this template:

$query3 = "insert into EZFinancing_Figures (App_id,year,make,model) values ('{$id}','{$_POST['year']}','{$_POST['make']}','{$_POST['model']}')";

etc

Also you should mysql_real_escape_string() all $_POST vars before putting them in the db.

Link to comment
Share on other sites

Also you should mysql_real_escape_string() all $_POST vars before putting them in the db.

 

Can you please explain, or show me an example, I do not know what that means?

 

 

BTW: Thank you, your code solved my problem... Should I rewrite the 2 other querys (or is it "queries,") the same way?

Link to comment
Share on other sites

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.