Jump to content

Firebird query to update MYSQL - Loop


radagast

Recommended Posts

Hello

 

I am hoping someone can PLEASSSSSSE help me :confused:

 

I am trying to do the following php Script..

 

 

//Getting Information for firebird database from supplier/distributor

 

try {

    $dbh = new PDO($dsndb, $userdb, $passdb);

 

    $sth = ("SELECT * from order WHERE account_number = 'abc123'");

 

 

  foreach ($dbh->query($sth) as $row)

     

// If I do print $row['order_number'].' - '. $row['customer_ref'] . '<br />'; returns all data..

    {

    $row['order_number'];

$row['customer_ref'];

      }

 

} catch (PDOException $e) {

  echo 'You have the following error : ' . $e->getMessage() . "<br/>";

  die();

}

 

$on = $row['order_number'];

$ref =  $row['customer_ref'];

 

// Need to update MYSQL Database but not sure how to create loop??????

 

 

 

        mysql_connect("localhost", "user", "password") or die(mysql_error());

mysql_select_db("xoccoza_online") or die(mysql_error());

 

$sql = "UPDATE customer SET customer_ref = '$ref' WHERE order_number = '$on' and customer_ref IS NULL";

$result=mysql_query($sql) or die(mysql_error());

 

 

Any and all help will be greatly appreciated

Link to comment
https://forums.phpfreaks.com/topic/264219-firebird-query-to-update-mysql-loop/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

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