Thank you for your help, I think I'm getting closer but still
not working.
what I'm trying to do is get data from a MySQL table written
to a file
"wmevents.csv" so I can make that file avilable for download.
when I run the query in PHPmyAdmin I get this error:
SQL query:
SELECT event, location, eventTime, eventDate
INTO OUTFILE 'wmEvents.csv'
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n'
FROM commingEvents
MySQL said:
#1045 - Access denied for user: 'wmevents@localhost' (Using
password: YES)
If I add it in the SQL box of the Recordest menu in
DreamWeaver and the try
to preview the page I get this error:
Parse error: parse error, unexpected
T_CONSTANT_ENCAPSED_STRING in
/home/wmevents/public_html/untitled.php on line 33
This is the php code that DreamWeaver wrote:
<?php require_once('Connections/events.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType,
$theDefinedValue = "",
$theNotDefinedValue = "")
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue)
: $theValue;
$theValue = function_exists("mysql_real_escape_string") ?
mysql_real_escape_string($theValue) :
mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" :
"NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) .
"'" :
"NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" :
"NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue :
$theNotDefinedValue;
break;
}
return $theValue;
}
}
mysql_select_db($database_events, $events);
$query_getEvents = "SELECT event, location, eventTime,
eventDate INTO
OUTFILE 'wmEvents.csv' FIELDS TERMINATED BY ',' ENCLOSED BY
'"' LINES
TERMINATED BY '\n' FROM commingEvents";
$getEvents = mysql_query($query_getEvents, $events) or
die(mysql_error());
$row_getEvents = mysql_fetch_assoc($getEvents);
$totalRows_getEvents = mysql_num_rows($getEvents);
?>
Thank You
Jeff
"David Powers" <david@example.com> wrote in message
news:ef3cqi$lms$1@forums.macromedia.com...
> Jeff wrote:
>> I've tried to run this query to write the contents
of a table to a file:
>>
>> SELECT * FROM `commingEvents` WHERE 1
>> select event, location, eventTime, eventDate
>> into outfile 'wmEvents.csv'
>> fields terminated by ',' optionally enclosed by '"'
>> lines terminated by '\n'
>
> SELECT event, location, eventTime, eventDate
> INTO OUTFILE 'wmEvents.csv'
> FIELDS TERMINATED BY ','
> ENCLOSED BY '"'
> LINES TERMINATED BY '\n'
> FROM commingEvents
>
> --
> David Powers
> Adobe Community Expert
> Author, "Foundation PHP for Dreamweaver 8" (friends of
ED)
>
http://foundationphp.com/