Why doesn't this work?
Posted: Thu Jul 16, 2009 12:02 pm
Well I have been doing this for about a year now and I am just starting to dig deeper into Php on a daily basis. That being said I have no idea why this isn't working.
Any help would be greatly appreciated
Thank you in advance
Code: Select all
<?php
# FileName="Connection_php_mysql.htm"
# Type="MYSQL"
# HTTP="true"
$hostname = "mysql.last7studios.com";
$database = "last7studios";
$username = "chris";
$password = "*********";
$last7 = mysql_pconnect($hostname, $username, $password) or trigger_error(mysql_error(),E_USER_ERROR);
mysql_select_db($database,$last7);
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
?>
<?php
$server_call = mysql_query("SELECT email_id, emails, username_email FROM internal_email") or die(mysql_error());
$new_row = mysql_fetch_assoc($server_call);
do {
$list = $new_row['username_email'];
$to_line = $new_row['emails'];
$username = $list;
$query = mysql_query("SELECT project_names.project_name, users.username, tasks.task_description, tasks.status, tasks.task_priority, tasks.task_id, tasks.project_id, tasks.task FROM users, project_names, tasks WHERE users.username = '$username' AND tasks.project_id = project_names.project_id AND tasks.user_id = users.user_id ORDER BY tasks.status DESC") or die(mysql_error());
$task_row = mysql_fetch_assoc($query);
$query_pn = mysql_query("SELECT * FROM project_names WHERE project_id = '$id'") or die(mysql_error());
$project_row = mysql_fetch_assoc($query_pn);
if(mysql_num_rows > 0){
$to = $to_line;
$subject = "you have tasks!";
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$body = "$status";
$body .= "$priority";
$body .= "$name_pro";
$body .= "\n";
do{
$body .= '<br />';
$body .= $task_row['username'];
$body .= '<br />';
$body .= $task_row['status'];
$body .= '<br />';
$body .= $task_row['task_priority'];
$body .= '<br />';
$body .= $task_row['project_name'];
$body .= '<br />';
$body .= $task_row['task'];
$body .= '<br />';
$body .= '<br />';
}
while($task_row = mysql_fetch_assoc($query));
if (mail($to, $subject, $body, $headers)) {
echo("<p>Message successfully sent!</p>");
} else {
echo("<p>Message delivery failed...</p>");
}
};
}while($new_row = mysql_fetch_assoc($server_call));
?>
<?php echo $_SERVER['DOCUMENT_ROOT'];?>
<?php echo $rows_stuff ;?>
Thank you in advance