Dan Lewis
Member
Registered: 31st Jan 05
Location: Leicestershire
User status: Offline
|
I'm looking for information on how to go about exporting data.
This connects to the oracle database and pulls the user names.
code: <!-- start content -->
<div id=content>
<div class=post>
<h1 class=title><a href=#>SoD Analyzer</a></h1>
<div class=entry>
<form name=resp_gen method=post action=User_Resp_Creation_process.php>
<table>
<tr>
<td>Username to be Checked(*):</td>
<td>
<select name=username_to_be_checked>
<?
$ORACLE_CONNECT = OCILogon($ORACLE_USERNAME, $ORACLE_PASSWORD, $ORACLE_SID);
$query_username_to_be_checked = "
SELECT DISTINCT USER_NAME
FROM FND_USER
WHERE (END_DATE IS NULL
OR END_DATE > SYSDATE)
ORDER BY USER_NAME
";
$ORACLE_STATIC = OCIParse($ORACLE_CONNECT, $query_username_to_be_checked);
OCIExecute($ORACLE_STATIC, OCI_DEFAULT);
while ($PRINT_RECORD = oci_fetch_array ($ORACLE_STATIC, OCI_BOTH))
{
echo "<option value=" . $PRINT_RECORD[0] . ">" . $PRINT_RECORD[0] . "</option>";
}
?>
</select>
</tr>
<tr>
<td colspan=2 align=center><input type=submit name=submit value=Generate List></td>
</tr>
</table>
</form>
</div>
</div>
</div>
<!-- end content -->
I then have another part that connects to our sql data base and pulls out some data.
So it goes,
Oracle- Username
SQL- Data
How would i get the two to combine and export as a csv file.
|
Sam
Moderator Premium Member
Registered: 24th Dec 99
Location: West Midlands
User status: Offline
|
Temporarily store the data in an XML file or an array, then format those values using PHP's CSV functions, then write to a file
http://uk3.php.net/manual/en/function.fputcsv.php
[Edited on 29-01-2009 by Sam]
|
Dan Lewis
Member
Registered: 31st Jan 05
Location: Leicestershire
User status: Offline
|
im new to all this, just created that to connect and view the names doing the sql part now.
|
Sam
Moderator Premium Member
Registered: 24th Dec 99
Location: West Midlands
User status: Offline
|
Try this Dan:
http://www.ineedtutorials.com/articles/export-mysql-data-to-csv-php-tutorial
|
Dan Lewis
Member
Registered: 31st Jan 05
Location: Leicestershire
User status: Offline
|
Ive got the arrays sorted now thanks sam
|
Sam
Moderator Premium Member
Registered: 24th Dec 99
Location: West Midlands
User status: Offline
|
|
Dan Lewis
Member
Registered: 31st Jan 05
Location: Leicestershire
User status: Offline
|
Have another thing now...
code: <? include("header.inc.php"); ?>
<!-- start content -->
<div id=content>
<div class=post>
<h1 class=title><a href=#>SoD Analyzer</a></h1>
<div class=entry>
<form name=resp_gen method=post action=User_Resp_Creation_process.php>
<table>
<tr>
<td>Username to be Checked(*):</td>
<td>
<select name=username_to_be_checked>
<?
$ORACLE_CONNECT = OCILogon($ORACLE_USERNAME, $ORACLE_PASSWORD, $ORACLE_SID);
$query_username_to_be_checked = "
SELECT DISTINCT USER_NAME
FROM FND_USER
WHERE (END_DATE IS NULL
OR END_DATE > SYSDATE)
ORDER BY USER_NAME
";
$ORACLE_STATIC = OCIParse($ORACLE_CONNECT, $query_username_to_be_checked);
OCIExecute($ORACLE_STATIC, OCI_DEFAULT);
while ($PRINT_RECORD = oci_fetch_array ($ORACLE_STATIC, OCI_BOTH))
{
echo "<option value=" . $PRINT_RECORD[0] . ">" . $PRINT_RECORD[0] . "</option>";
}
?>
<select name=Respon>
<?
$list=mysql_query("SELECT RESP_GROUP, RESPONSIBILITY FROM FOX_MASTER_ACCESS_GROUPS");
while($row_list=mysql_fetch_assoc($list)){
?>
<option value="<? echo $row_list['RESPONSIBILITY']; ?>" <? if($row_list['RESPONSIBILITY']==$select){ echo "selected"; } ?>><? echo $row_list['RESPONSIBILITY']; ?></option>
</select>
<input type="submit" name="Submit_The_Data" value="Select" />
</form>
</tr>
<tr>
<td colspan=2 align=center></td>
</tr>
</table>
<table>
<hr>
<p>
</table>
</div>
</div>
</div>
The error i am getting;
Parse error: syntax error, unexpected $end in /var/www/FOX/User_Respon_Creation.php on line 54
|
Dan Lewis
Member
Registered: 31st Jan 05
Location: Leicestershire
User status: Offline
|
fixed 
Had an extra { on a line
|