Code help request
Posted: Sat Dec 11, 2010 12:52 pm
Hello,
Let me start with stating I am NOT a PHP programmer but have used snippets and code when needed and found through the internet to get functionality i need in the past. I am SLOWLY trying to learn PHP5 mainly on a trial and error bases. That having been said, the code below doesn't work, I'm of the thought that I have to use a SELECT query first and also that my syntax is wrong. If someone can look simply at the query and advise wher it might be going wrong at I would appreciate it. ( and yes in advance the page does have the requisit <?php and matching close tags etc. etc. etc., but the remainder of the code is just some echoed HTML code)
Thanks,
Robert
Let me start with stating I am NOT a PHP programmer but have used snippets and code when needed and found through the internet to get functionality i need in the past. I am SLOWLY trying to learn PHP5 mainly on a trial and error bases. That having been said, the code below doesn't work, I'm of the thought that I have to use a SELECT query first and also that my syntax is wrong. If someone can look simply at the query and advise wher it might be going wrong at I would appreciate it. ( and yes in advance the page does have the requisit <?php and matching close tags etc. etc. etc., but the remainder of the code is just some echoed HTML code)
Code: Select all
require("connect.php");
mysql_connect($hostname,$username, $password) or die ('Unable to connect to database! Please try again later.');
mysql_select_db($dbname) or die('Unable to select database');
$x = $_POST[Payamt];
$id = $_POST[Payidnumber];
@mysql_query("UPDATE addcon SET Balance = (Balance - '$x') WHERE ID_Number = '$id' AND Balance => '$x'");Thanks,
Robert