Page 1 of 1

String Problem

Posted: Thu Dec 28, 2006 12:18 pm
by dbdvd7
Anyone know why this string doesn't work? Very green to php and have been messing with this for a day, anything will help.

Code: Select all

<?
error_reporting(E_ALL);
require("popupheader.inc");


$dbh=mysql_connect ("localhost", "", "");
mysql_select_db ("");

$result= mysql_query("SELECT * FROM CartItems")
or die(mysql_error());

$row = mysql_fetch_array($result); 

$order_string = <<< String

$row['product_name']
$row['Small']
$row['Medium']
$row['Large']
$row['XLarge']
String;
	

mail("ddunn@extramediumapparel.com","Order",$order_string);

    echo"<table border='0' cellspacing='10' cellpadding='10'>";

  echo"<tr><th>Thank You.  Your order has been processed and a confirmation e-mail will be sent to you.</tr></th>";


?>

Posted: Thu Dec 28, 2006 12:31 pm
by feyd
I'll assume you're referring to your usage of heredoc.

I'd reason that you're attempting to use complex insertions.

The manual should be of use here. http://php.net/language.types.string

Posted: Thu Dec 28, 2006 12:40 pm
by daedalus__
Is there a reason that you need to use heredoc for this?

P.S. complex insertions are hot, rofl!

Posted: Thu Dec 28, 2006 12:51 pm
by dbdvd7
Im just trying to pull orders off mysql and have the respective sizes of each model emailed to me. I can get one model and sizes but not all of them. Is there an easier way?

Posted: Thu Dec 28, 2006 1:10 pm
by daedalus__
uhhhhhhhhh

if i remember correctly, rofl:

Code: Select all

$order_string = "
{$row['product_name']}\n
{$row['Small']}\n
{$row['Medium']}\n
{$row['Large']}\n
{$row['XLarge']}\n
";

Posted: Thu Dec 28, 2006 2:07 pm
by kingconnections
ok so I would do it like so:

Code: Select all

$order_string = "$row['product_name'] $row['Small'] $row['Medium']  $row['Large']  $row['XLarge'] "; 
        

mail("ddunn@extramediumapparel.com","Order",$order_string);
Or something to that effect... format your $order_string how you want it.
edited....

Just saw what Daedalus put... LOL ya what he said.