Greetings,
I am trying to upload the following php code onto my webserver and I am getting the error shown at the bottom of this post. Would someone please tell me what I am doing wrong, here? I thought I was following step-by-step php assembly instructions but, attempting to upload errors out. I replaced some username and password data with “xxxxxxxx for posting purposes.
Apparently, I have one, or more, syntax errors but I do not know what or where they are and don't grock [DEF at line 1] in the error message. Any help would be greatly appreciated. Thank you.
<?php
DEFINE ('DBUSER','q688449xxxxxxxx')
DEFINE ('DBPW', 'Junxxxxxxx')
DEFINE ('DBHOST','q688449xxxxxxxx.db.44911905.f6d.hostedresource.net')
DEFINE ('DBNAME', 'q688449xxxxxxxx')
$dbc = mysqli_connect('q688449xxxxxxxx.db.44911905.f6d.hostedresource.net','q6884491xxxxxxxx,'Junxxxxxxx');
if (!$dbc) {
die("Database connection failed: " . mysqli_error($dbc));
exit();}
$dbs = mysqli_select_db($dbc, 'q688449xxxxxxxx');
if (!$dbs) {
die("Database selection failed: " . mysqli_error($dbc));
exit();}
$result = mysqli_query($dbc, "SHOW COLUMNS FROM customer");
$numberOfRows = mysqli_num_rows($result);
if ($numberOfRows > 0) {
$values = mysqli_query($dbc, "SELECT * FROM customer ");
while ($rowr = mysqli_fetch_row($values)) {
for ($j=0;$j<$numberOfRows;$j++) {
$csv_output .= $rowr[$j].", ";
}
$csv_output .= "\n";
}
}
print $csv_output;
exit;
?>
Error
MySQL said:
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '<?php
DEFINE ('DBUSER','q688449xxxxxxxx')
DEFINE ('DBPW', 'Junxxxxxxx')
DEF' at line 1