MySQL Forums
Forum List  »  IBM DB2

Re: How to get data from AS400 to MySQL
Posted by: Stefano Sacco
Date: September 02, 2006 02:34AM

I have installed mysql and Zendcore (PHP) on my AS400. I use this script



<?php


$ASdbname='127.0.0.1';
$ASdbuser='root';
$ASdbpwd='root';
$database='test';


$connessione = mysql_pconnect($ASdbname, $ASdbuser, $ASdbpwd) or die("Connessione non riuscita: " . mysql_error());
print("connection ok!");



//--------------------------------------------------------------------------------------
// CREAZIONE TABELLA, PRESUPPONE L'ESISTENZA DEL DATA BASE
//--------------------------------------------------------------------------------------
// $query = 'CREATE TABLE rubrica (nickname CHAR(40), email CHAR(80))';
// $ri = mysql_db_query($database, $query, $connessione );
// if (!$ri) {
// echo "<h1>Creazione della tabella fallita!".mysql_error()."</h1>";
//
// exit;
// } else {
// echo "<h1>Creazione della tabella riuscita.</h1>";
// }



mysql_select_db($database);
mysql_query("INSERT INTO rubrica (nickname,email) VALUES ('kossu','kossu@yahoo.it') ");

$query = "SELECT * FROM rubrica";
$risultato = mysql_query($query) or die("Query fallita");



print "<table>\n";
while ($linea = mysql_fetch_array($risultato, MYSQL_ASSOC)) {
print "\t<tr>\n";
foreach ($linea as $valore_colonna) {
print "\t\t<td>$valore_colonna</td>\n";
}
print "\t</tr>\n";
}
print "</table>\n";


/* Liberazione delle risorse del risultato */
mysql_free_result($risultato);

/* Chiusura della connessione */
mysql_close($connessione);


print("end script");


?>

Options: ReplyQuote


Subject
Views
Written By
Posted
20065
November 03, 2004 05:22PM
10808
November 03, 2004 05:24PM
13472
November 04, 2004 08:27AM
9286
March 15, 2005 02:17PM
Re: How to get data from AS400 to MySQL
10615
September 02, 2006 02:34AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.