Jump to content

GKWelding

Members
  • Posts

    268
  • Joined

  • Last visited

About GKWelding

  • Birthday 10/09/1983

Contact Methods

  • Website URL
    http://www.in-the-attic.co.uk

Profile Information

  • Gender
    Male
  • Location
    UK

GKWelding's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Well there's your issue, the array has only 1 element. your inner foreach is working fine.
  2. jQuery ajax will initialise data as an empty string because the CSS file does not contain an overall block level element. I would change it to var script = document.createElement("script"); script.type = "text/css"; script.src = "/css/style.css"; document.body.appendChild(script);
  3. First, CODE tags make things much clearer. Second, just before foreach ($response->records as $record) { Can you do a var_dump($response->records);die(); and post the output here.
  4. For a start, what does the line if(!isset($_GET['c_id'])) do? Nothing by the looks of it. And your error message is correct. $c_id isn't defined anywhere. I would replace the above line with $c_id = $_GET['c_id']; And that page will work. However, the mix of PHP and display code isn't nice, if I were you I'd do some reading on design patterns.
  5. <?php $connect=mysql_connect("localhost","root",""); mysql_select_db("bank",$connect) or die ("could not select database"); $account_number=''; $tran_id=''; if(isset($_POST['account_number'])) $account_number=$_POST['account_number']; else $account_number=''; //getting the faulty transaction $query = "select * from transaction WHERE account_number='$account_number'"; $result = mysql_query($query) or die(mysql_error()); $row = mysql_fetch_assoc($result); //Correcting the account table if(strtolower('transaction_type')=="deposit"){ $operator = "-"; }else{ $operator = "+"; } $query= "UPDATE account SET `account_balance`=(`account_balance`".$operator.$row['transaction_amount'].") WHERE account_number='$account_number'"; mysql_query($query) or die(mysql_error()); //deleting the faulty transaction $query = "DELETE from transaction WHERE account_number='$account_number'"; mysql_query($query) or die(mysql_error()); ?> Also, TBH, now you really should be using mysqli rather than mysql.
×
×
  • 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.