View unanswered posts | View active topics It is currently Thu Dec 14, 2017 11:36 pm



Reply to topic  [ 2 posts ] 
 write to dbf 
Author Message
Junior Member

Joined: Mon Sep 27, 2004 10:45 pm
Posts: 1
Post 
hi all,
i want to download my data for example :
$data=mysql_fetch_array($firstdata);
data of $data will download to .dbf using Php.
how can i do it?

regards,
renne


Mon Sep 27, 2004 11:04 pm
Report this post
Profile
Junior Member

Joined: Wed Feb 16, 2005 10:34 pm
Posts: 5
Post 
First of all, fetch your MySQL data with something like this :

# Fetching MySQL
$arrayDef=array();
while ($row = mysql_fetch_array($firstdata, MYSQL_ASSOC)){
$arrayDef[]=array($row["value1"],$row["value2"]);
}

Ok. Now I'm not sure if you already have a dbf file that you want to update or no dbf, so you want to create it first. I will assume that you dont have any dbf yet. I will assume also that you have fetched only the good data with your MySQL query and that these 2 datas are "value1" and "value2"...

Something like this should do the trick :


# Creation of dbf
$dbasePath="/yourowndbasepath/file.dbf";
$def=array(
array("value1","N",4,0),
array("value2","C",50)
);
if (!dbase_create($dbasePath, $def)) {
die("Error, can't create the database");
}
# Entering the results in your dbf
$db = dbase_open($dbasePath,2);
if ($db){
reset($arrayDef);
while (list($key,$val)=each($arrayDef)){
dbase_add_record($db,$val);
}
dbase_close($db);
}

For any other thing you want to do with dbf, you can consult PHP doc on dBase Functions.


Fri Feb 18, 2005 6:29 am
Report this post
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 2 posts ] 

Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
© Copyright 2003-2008 www.php-editors.com. The ultimate PHP Editor and PHP IDE site.