Hello guys, Im a newbie at MySQL and PHP and started working on a little project. I used snippets of information here and there to create my code, so it might not be very well written but it does the job, except there's one little bug. I want to be able to insert my MySQL data into an array for mailtxt and also for a google api (bottom code of php where it shows numbers). I would like to be able to insert the results from my form.
<?php
mysql_connect("localhost", "username", "password") or die(mysql_error());
mysql_select_db("database_name") or die(mysql_error());
$result = mysql_query("SELECT * FROM data_table WHERE id= (SELECT max(id) FROM data_table)")
or die(mysql_error());
$mailtxt;
$row = mysql_fetch_array( $result );
$mailtxt .=" Name: *********this is the part i cant figure out*******. how should i call the array so it fetches the correct result. If im confusing you, scroll all the way to the bottom\n";
$mailtxt .=" Phone: $row\n";
$mailtxt .=" Email: $_GET[Email]\n";
echo "Name: ".$row['Name']; echo "<br />";
echo "Phone Number: ".$row['Phone']; echo "<br />";
echo "Email: ".$row['Email']; echo "<br />";
//$email = $row['Email']; //senders e-mail adress
//$subject = "Subject for reviever"; //subject
//mail($recipient, $subject)
$email = "myemail@abc.com"; //senders e-mail adress
$recipient = $row['Email']; //recipient
$subject = "Results"; //subject
mail($recipient, $subject, $mailtxt); //mail command :)?>
<?php
require ("gChart.php");
$piChart = new gPieChart();
$piChart->set3D(true);
//In the code below, i would like to insert my values from the data into array(112,315,66,40) instead of actual numbers. Thanks guys
$piChart->addDataSet(array(112,315,66,40));
$piChart->setLegend(array("Lighting", "Kitchen", "House","Misc"));
$piChart->setLabels(array("Lighting", "Kitchen", "House","Misc"));
$piChart->setColors(array("ff3344", "11ff11", "22aacc", "3333aa"));
?>
<img src="<?php print $piChart->getUrl(); ?>" />