Cobb
02-28-2012, 12:21 AM
One php file has the following code in it:
<?php
include ("includes/emailRetrieve.php");
$name = $_GET['name'];
echo $name
$emailDetails = GetEmailContent($inName = $name);
foreach ($emailDetails as $post)
{
$subject = $post->subject;
$body = $post->body;
$email = $post->email;
echo $name;
echo $subject;
echo $body;
echo $email;
?>
And is crashing when it gets to '$emailDetails = GetEmailContent($inName = $name);'.
Here is emailRetreieve.php
<?php
echo "hello";
include 'emailDetails.php';
// Succesfully connects to DB.
function GetEmailContent($inName=null)
{
echo "in function";
if (!empty($inName))
{
$query = mysql_query("SELECT * FROM shop_email WHERE name = '$inName'");
}
$emailArray = array();
while ($row = mysql_fetch_assoc($query))
{
$emailContent = new EmailDetails($row["id"], $row['name'], $row['subject'], $row['body']);
array_push($emailArray, $emailContent);
}
return $emailArray;
}
?>
I know its stopping at that line because i've commented out the php from that point onwards, and the stuff before executes fine. It just throws a fit when calling the function. Any ideas why?
Thank you.
<?php
include ("includes/emailRetrieve.php");
$name = $_GET['name'];
echo $name
$emailDetails = GetEmailContent($inName = $name);
foreach ($emailDetails as $post)
{
$subject = $post->subject;
$body = $post->body;
$email = $post->email;
echo $name;
echo $subject;
echo $body;
echo $email;
?>
And is crashing when it gets to '$emailDetails = GetEmailContent($inName = $name);'.
Here is emailRetreieve.php
<?php
echo "hello";
include 'emailDetails.php';
// Succesfully connects to DB.
function GetEmailContent($inName=null)
{
echo "in function";
if (!empty($inName))
{
$query = mysql_query("SELECT * FROM shop_email WHERE name = '$inName'");
}
$emailArray = array();
while ($row = mysql_fetch_assoc($query))
{
$emailContent = new EmailDetails($row["id"], $row['name'], $row['subject'], $row['body']);
array_push($emailArray, $emailContent);
}
return $emailArray;
}
?>
I know its stopping at that line because i've commented out the php from that point onwards, and the stuff before executes fine. It just throws a fit when calling the function. Any ideas why?
Thank you.