problem with "Echo"
Posted: Wed Nov 18, 2009 10:20 am
Hi all
Up until a couple of hours ago I never even dreamed of looking at a php script. However, I found myself needing a script to extract products from an oscommerce database and so I had no choice but to modify an example I found online.
The challenge I am facing is that I am getting a parsing error when I try to run the script and because I dont know what I am doing I really need some help.
Apart from fixing the code I need to do the following:
1) Set the field delimeter to tab.
2) When the user clicks the export button it must give him the option to save the file.
I am using the following code:
<?php
$fieldseparator = ',';
require('includes/application_top.php');
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
</head>
<body marginwidth="0" marginheight="0" topmargin="25" bottommargin="0" leftmargin="25" rightmargin="0" bgcolor="#FFFFFF">
<?php
$query1 = mysql_query("SELECT products_description.products_name, products_description.products_description, products.products_image, products.products_image_med, products.products_image_lrg, products.products_image_sm_1, products.products_image_xl_1,products.products_image_sm_2,products.products_image_xl_2,products.products_image_sm_3,products.products_image_xl_3,products.products_image_sm_4,products.products_image_xl_4,products.products_image_sm_5,products.products_image_xl_5,products.products_image_sm_6,products.products_image_xl_6,products.products_price,products.products_date_added,products.products_last_modified,products.products_date_available,products.products_weight,products.products_status FROM products Inner Join products_description ON products.products_id = products_description.products_id WHERE products_description.language_id = '1'") or die (mysql_error());
$tabel1 = mysql_fetch_array($query1);
$products_name = $table1['products_name'];
$products_description = $table1['products_description'];
$products_image = $table1['products_image'];
$products_image_med = $table1['products_image_med'];
$products_image_lrg = $table1['products_image_lrg'];
$products_image_sm_1 = $table1['products_image_sm_1'];
$products_image_xl_1 = $table1['products_image_xl_1'];
$products_image_sm_2 = $table1['products_image_sm_2'];
$products_image_xl_2 = $table1['products_image_xl_2'];
$products_image_sm_3 = $table1['products_image_sm_3'];
$products_image_xl_3 = $table1['products_image_xl_3'];
$products_image_sm_4 = $table1['products_image_sm_4'];
$products_image_sm_5 = $table1['products_image_sm_5'];
$products_image_xl_5 = $table1['products_image_xl_5'];
$products_image_sm_6 = $table1['products_image_sm_6'];
$products_image_xl_6 = $table1['products_image_xl_6'];
$products_price = $table1['products_price'];
$products_date_added = $table1['products_date_added'];
$products_last_modified = $table1['products_last_modified'];
$products_date_available = $table1['products_date_available'];
$products_weight = $table1['products_weight'];
$products_status = $table1['products_status'];
// combine all the fields into the variable '$export'
$export = $products_name.$fieldseparator
.$products_description.$fieldseparator
.$products_image.$fieldseparator
.$products_image_med.$fieldseparator
.$products_image_lrg.$fieldseparator
.$products_image_sm_1.$fieldseparator
.$products_image_xl_1.$fieldseparator
.$products_image_sm_2.$fieldseparator
.$products_image_xl_2.$fieldseparator
.$products_image_sm_3.$fieldseparator
.$products_image_xl_3.$fieldseparator
.$products_image_sm_4.$fieldseparator
.$products_image_xl_4.$fieldseparator
.$products_image_sm_5.$fieldseparator
.$products_image_xl_5.$fieldseparator
.$products_image_sm_6.$fieldseparator
.$products_image_xl_6.$fieldseparator
.$products_price.$fieldseparator
.$products_date_added.$fieldseparator
.$products_last_modified.$fieldseparator
.$products_date_available.$fieldseparator
.$products_weight.$fieldseparator
.$products_status.$fieldseparator
echo "<table><tr><td class=main colspan=2><b>Er is een CSV-exportbestand aangemaakt voor:</b><br><br>";
echo "products_description: <b>".$products_description."</b><br>";
echo "products_name": <b>".$products_name."</b><br>;
echo "products_image: <b>".$products_image."</b><br>";
echo "products_image_med: <b>".$products_image_med."</b><br>";
echo "products_image_lrg: <b>".$products_image_lrg."</b><br>";
echo "products_image_sm_1: <b>".$products_image_sm_1."</b><br>";
echo "products_image_xl_1: <b>".$products_image_xl_1."</b><br>";
echo "products_image_sm_1: <b>".$products_image_sm_2."</b><br>";
echo "products_image_xl_1: <b>".$products_image_xl_2."</b><br>";
echo "products_image_sm_1: <b>".$products_image_sm_3."</b><br>";
echo "products_image_xl_1: <b>".$products_image_xl_3."</b><br>";
echo "products_image_sm_1: <b>".$products_image_sm_4."</b><br>";
echo "products_image_xl_1: <b>".$products_image_xl_4."</b><br>";
echo "products_image_sm_1: <b>".$products_image_sm_5."</b><br>";
echo "products_image_xl_1: <b>".$products_image_xl_5."</b><br>";
echo "products_image_sm_1: <b>".$products_image_sm_6."</b><br>";
echo "products_image_xl_1: <b>".$products_image_xl_6."</b><br>";
echo "products_price: <b>".$products_price."</b><br>";
echo "products_date_added: <b>".$products_date_added."</b><br>";
echo "products_last_modified: <b>".$products_last_modified."</b><br>";
echo "products_date_available: <b>".$products_date_available."</b><br>";
echo "products_weight: <b>".$products_weight."</b><br>";
echo "products_status: <b>".$products_status."</b><br>";
echo "<td></tr><BR><center><font face=verdana size=1>osC CSV Export 1.0<HR><BR>";
// toon verzamelde velden in tekstveld (incl. mogelijkheid om de complete inhoud te selecteren
echo "<tr><td><BR><BR><form>
<input type=button value='Selecteer inhoud van het hele veld' onClick='javascript:this.form.scriptsource.focus();this.form.scriptsource.select();'><br>
<textarea name=scriptsource rows=10 cols=50 wrap=ON>".$export."</textarea></form></td></tr></table></html>";
?>
Thanks
Up until a couple of hours ago I never even dreamed of looking at a php script. However, I found myself needing a script to extract products from an oscommerce database and so I had no choice but to modify an example I found online.
The challenge I am facing is that I am getting a parsing error when I try to run the script and because I dont know what I am doing I really need some help.
Apart from fixing the code I need to do the following:
1) Set the field delimeter to tab.
2) When the user clicks the export button it must give him the option to save the file.
I am using the following code:
<?php
$fieldseparator = ',';
require('includes/application_top.php');
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
</head>
<body marginwidth="0" marginheight="0" topmargin="25" bottommargin="0" leftmargin="25" rightmargin="0" bgcolor="#FFFFFF">
<?php
$query1 = mysql_query("SELECT products_description.products_name, products_description.products_description, products.products_image, products.products_image_med, products.products_image_lrg, products.products_image_sm_1, products.products_image_xl_1,products.products_image_sm_2,products.products_image_xl_2,products.products_image_sm_3,products.products_image_xl_3,products.products_image_sm_4,products.products_image_xl_4,products.products_image_sm_5,products.products_image_xl_5,products.products_image_sm_6,products.products_image_xl_6,products.products_price,products.products_date_added,products.products_last_modified,products.products_date_available,products.products_weight,products.products_status FROM products Inner Join products_description ON products.products_id = products_description.products_id WHERE products_description.language_id = '1'") or die (mysql_error());
$tabel1 = mysql_fetch_array($query1);
$products_name = $table1['products_name'];
$products_description = $table1['products_description'];
$products_image = $table1['products_image'];
$products_image_med = $table1['products_image_med'];
$products_image_lrg = $table1['products_image_lrg'];
$products_image_sm_1 = $table1['products_image_sm_1'];
$products_image_xl_1 = $table1['products_image_xl_1'];
$products_image_sm_2 = $table1['products_image_sm_2'];
$products_image_xl_2 = $table1['products_image_xl_2'];
$products_image_sm_3 = $table1['products_image_sm_3'];
$products_image_xl_3 = $table1['products_image_xl_3'];
$products_image_sm_4 = $table1['products_image_sm_4'];
$products_image_sm_5 = $table1['products_image_sm_5'];
$products_image_xl_5 = $table1['products_image_xl_5'];
$products_image_sm_6 = $table1['products_image_sm_6'];
$products_image_xl_6 = $table1['products_image_xl_6'];
$products_price = $table1['products_price'];
$products_date_added = $table1['products_date_added'];
$products_last_modified = $table1['products_last_modified'];
$products_date_available = $table1['products_date_available'];
$products_weight = $table1['products_weight'];
$products_status = $table1['products_status'];
// combine all the fields into the variable '$export'
$export = $products_name.$fieldseparator
.$products_description.$fieldseparator
.$products_image.$fieldseparator
.$products_image_med.$fieldseparator
.$products_image_lrg.$fieldseparator
.$products_image_sm_1.$fieldseparator
.$products_image_xl_1.$fieldseparator
.$products_image_sm_2.$fieldseparator
.$products_image_xl_2.$fieldseparator
.$products_image_sm_3.$fieldseparator
.$products_image_xl_3.$fieldseparator
.$products_image_sm_4.$fieldseparator
.$products_image_xl_4.$fieldseparator
.$products_image_sm_5.$fieldseparator
.$products_image_xl_5.$fieldseparator
.$products_image_sm_6.$fieldseparator
.$products_image_xl_6.$fieldseparator
.$products_price.$fieldseparator
.$products_date_added.$fieldseparator
.$products_last_modified.$fieldseparator
.$products_date_available.$fieldseparator
.$products_weight.$fieldseparator
.$products_status.$fieldseparator
echo "<table><tr><td class=main colspan=2><b>Er is een CSV-exportbestand aangemaakt voor:</b><br><br>";
echo "products_description: <b>".$products_description."</b><br>";
echo "products_name": <b>".$products_name."</b><br>;
echo "products_image: <b>".$products_image."</b><br>";
echo "products_image_med: <b>".$products_image_med."</b><br>";
echo "products_image_lrg: <b>".$products_image_lrg."</b><br>";
echo "products_image_sm_1: <b>".$products_image_sm_1."</b><br>";
echo "products_image_xl_1: <b>".$products_image_xl_1."</b><br>";
echo "products_image_sm_1: <b>".$products_image_sm_2."</b><br>";
echo "products_image_xl_1: <b>".$products_image_xl_2."</b><br>";
echo "products_image_sm_1: <b>".$products_image_sm_3."</b><br>";
echo "products_image_xl_1: <b>".$products_image_xl_3."</b><br>";
echo "products_image_sm_1: <b>".$products_image_sm_4."</b><br>";
echo "products_image_xl_1: <b>".$products_image_xl_4."</b><br>";
echo "products_image_sm_1: <b>".$products_image_sm_5."</b><br>";
echo "products_image_xl_1: <b>".$products_image_xl_5."</b><br>";
echo "products_image_sm_1: <b>".$products_image_sm_6."</b><br>";
echo "products_image_xl_1: <b>".$products_image_xl_6."</b><br>";
echo "products_price: <b>".$products_price."</b><br>";
echo "products_date_added: <b>".$products_date_added."</b><br>";
echo "products_last_modified: <b>".$products_last_modified."</b><br>";
echo "products_date_available: <b>".$products_date_available."</b><br>";
echo "products_weight: <b>".$products_weight."</b><br>";
echo "products_status: <b>".$products_status."</b><br>";
echo "<td></tr><BR><center><font face=verdana size=1>osC CSV Export 1.0<HR><BR>";
// toon verzamelde velden in tekstveld (incl. mogelijkheid om de complete inhoud te selecteren
echo "<tr><td><BR><BR><form>
<input type=button value='Selecteer inhoud van het hele veld' onClick='javascript:this.form.scriptsource.focus();this.form.scriptsource.select();'><br>
<textarea name=scriptsource rows=10 cols=50 wrap=ON>".$export."</textarea></form></td></tr></table></html>";
?>
Thanks