- include("db/dbx.php3"); //[path to DBX]
-
- // Création d'une base
- $db=new dbx; //create object
- $db->dbx_query("create database test_db");
-
- // Création d'une table
- $db->dbx_query("create table testtable(id,name,city)");
-
- // On ajoute qq elements
- $db->dbx_query("insert into testtable values('1','Robin','New York')");
- $db->dbx_query("insert into testtable values('2','Martin','Los Angeles')");
- $db->dbx_query("insert into testtable values('3','Harvey','San Francisco')");
-
- // Affiche tous les elements
- $q=$db->dbx_query("SELECT * FROM testtable");
- echo("****************************<br>");
- while($result=$db->dbx_fetch_array($q))
- {
- echo ($result[ID] . "<br>");
- echo ($result[NAME] . "<br>");
- echo ($result[CITY] . "<br>");
- }
-
- // Modifie un element
- $db->dbx_query("UPDATE testtable SET name='Vincent',city='Paris' where id='2'");
-
- // Vide la table
- $db->dbx_query("delete from testtable"); //all rows are deleted
include("db/dbx.php3"); //[path to DBX]
// Création d'une base
$db=new dbx; //create object
$db->dbx_query("create database test_db");
// Création d'une table
$db->dbx_query("create table testtable(id,name,city)");
// On ajoute qq elements
$db->dbx_query("insert into testtable values('1','Robin','New York')");
$db->dbx_query("insert into testtable values('2','Martin','Los Angeles')");
$db->dbx_query("insert into testtable values('3','Harvey','San Francisco')");
// Affiche tous les elements
$q=$db->dbx_query("SELECT * FROM testtable");
echo("****************************<br>");
while($result=$db->dbx_fetch_array($q))
{
echo ($result[ID] . "<br>");
echo ($result[NAME] . "<br>");
echo ($result[CITY] . "<br>");
}
// Modifie un element
$db->dbx_query("UPDATE testtable SET name='Vincent',city='Paris' where id='2'");
// Vide la table
$db->dbx_query("delete from testtable"); //all rows are deleted