Seem to be having a bit of a problem calling a function from another php file. Here's my code:
<?php
include ("includes/includes.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;
?>
This also html in this file, but all that is working fine.
includes.php:
<?php
include 'blogpost.php';
include 'emailDetails.php';
// Connects to DB successfully
function GetBlogPosts($inUrl=null, $inTagId =null)
{
//This function works
}
function GetEmailContent($inName=null)
{
echo "in function";
if (!empty($inName))
{
$query = mysql_query("SELECT * FROM shop_email WHERE name = '$inName' ORDER BY id DESC");
}
else
{
echo "inName empty";
}
$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;
}
?>
When trying to run the first bit of code, all i get returned is a blank white page in firefox, and 'HTTP Error 500 (Internal Server Error): An unexpected condition was encountered while the server was attempting to fulfill the request.' in chrome.
By commenting things out i've worked out that everything works until the '$emailDetails = GetEmailContent($inName = $name);' line, that's when the page starts loading as blank.
I've also tried commenting out the entire GetEmailContent function, apart from 'echo "in function"', and i still get the same problem. It seems to me like there's some problem actually calling the function.
Any help would be massively appreciated, thank you.