I am getting an error that "y is undefined variable".
I know this will gonna be so simple and basic problem but I am new to php so that's why I am facing this problem.
please me its urgent for me. - <?php
-
$Amtoffirstrelease=$_POST['Amtoffirstrelease'];
-
$Amtofsecondrelease=$_POST['Amtofsecondrelease'];
-
$head=$_POST['head'];
-
$subhead=$_POST['subhead'];
-
$Availableamt=$Amtoffirstrelease+$Amtofsecondrelease;
-
$sanctionedamt=$_POST['sanctionedamt'];
-
$progressivebal=$y+$sanctionedamt;
-
$dbhost = "localhost";
-
$dbuser = "root";
-
$dbpass = "";
-
$dbname = "purchase";
-
mysql_connect($dbhost, $dbuser, $dbpass);
-
mysql_select_db($dbname) or die(mysql_error());
-
-
$x="SELECT MAX(progressivebal) FROM 'naipone'";
-
$y= mysql_query("SELECT progressivebal FROM 'naipone' WHERE progressivebal=x") or die('error');
-
$query="insert into naipone(Amtoffirstrelease, Amtofsecondrelease, head, subhead,
-
-
Availableamt,sanctionedamt,progressivebal) values
-
-
('$Amtoffirstrelease','$Amtofsecondrelease','$head','$subhead','$Availableamt','$sanctionedamt','$progressiveba
-
-
l')";
-
mysql_query($query)or die('error');
-
echo"database update with:" .$Amtoffirstrelease."" .$Amtofsecondrelease. "".$Availableamt."" .$head."".
-
-
$subhead."";
-
?>
5 1572
Line 8, you use a variable y without first assigning it a value.
Now its solved but its show error1 which at 18 line.
You should use mysql_error to know exactly what the error is.
You should maybe lose empty lines or try something like this -
$query="insert into naipone(Amtoffirstrelease, Amtofsecondrelease, head, subhead," .
-
-
"Availableamt,sanctionedamt,progressivebal) values" .
-
-
"('$Amtoffirstrelease','$Amtofsecondrelease','$head','$subhead','$Availableamt','$sanctionedamt','$progressiveba" .
-
-
"l')";
-
Thanks!
It works.I solved that problem. But now the main problem is progressivebal values does not update as I want (like line 9 and 18).
Thank you
We only allow one question per thread on this forum. Please create a new thread for your question.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Dan Finn |
last post by:
OpenBSD 3.2
Apache 1.3.26
PHP 4.3.4
PHP-Nuke 6.9
getting these in the apache error log:
Sun Nov 16 20:20:16 2003] PHP Notice: Undefined variable:
HTTP_USER_AGENT in...
|
by: Chris Beall |
last post by:
If you want your code to be bulletproof, do you have to explicitly check
for the existence of any possibly-undefined variable?
Example: window.outerHeight is defined by some browsers, but not...
|
by: prabhunew2005 |
last post by:
hi
I am doing web portal design using php.
I gave part of one of my screen coding.
<html>
<head>
<script language = "javascript">
function list_all_click()
|
by: Bob Bruyn |
last post by:
I've recently installed Apache 2 and php 5.2 on my WIndows XP
machine. Everything is up and running.
I'm passing some vars via the URL. It works fine online:...
|
by: siyaverma |
last post by:
Hi,
I am new to php, i was doing some small chnages in a project developed by my collegue who left the job and i got the responsibility for that,
After doing some changes when i run it on my...
|
by: Markus |
last post by:
I was just playing around with javascript today and i wanted to change the style of a table element with javascript.
The code i am using:
ChangeIt(id){
var target = document.getElementById(id)...
|
by: bob johnson |
last post by:
Notice: Undefined variable: db_host in C:\wamp\www\cbmall\index.php on line 7
Notice: Undefined variable: db_user in C:\wamp\www\cbmall\index.php on line 7
Notice: Undefined variable: db_pass...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |