This problem is solved. I should have used DATE_SUB instead of DATE_ADD along with a positive term of days instead of a negative one.

I have the following script which successfully finds the values for $payer_email, reminder_date and sub_expire_date, however where I am having trouble is when I apply a WHERE condition to the SELECT. The condition I am trying to apply is the commented out line at the end of the SELECT. The intention of the WHERE is to filter the values from the SELECT to only provide those values which point to the subscription expiry (sub_expire_date) thirty days ahead of time, but no values are found when they really should be.
Can anyone tell me what is wrong?

error_reporting(E_ALL ^ E_NOTICE);

include_once ("../real_conn/real_i_conn.php");
$reminder_date = date("Y-m-d", strtotime("+30 days"));
echo $reminder_date ."<br><br>";

$sql = "SELECT sec_tblpurchased_secureareas.users_id, sec_tblpurchased_secureareas.sub_expire_date, DATE_ADD(sec_tblpurchased_secureareas.sub_expire_date, INTERVAL - 30 day) AS reminder_date, sec_tblusers.payer_email
FROM sec_tblpurchased_secureareas
INNER JOIN sec_tblusers ON sec_tblusers.recid = sec_tblpurchased_secureareas.users_id";
//WHERE DATE_ADD(sec_tblpurchased_secureareas.sub_expire_date, INTERVAL - 30 day) = '". $reminder_date ."' ";

$result = mysqli_query($conni, $sql);

if ($result)
    // Return the number of rows in result set
    printf("Result set has %d rows.\n",$rowcount);
    echo "<br><br>";

while ($num = mysqli_fetch_array($result)) {
    //echo $num;

    $payer_email        = $num['payer_email'];
    echo $num['payer_email'] . "  <br>";

    $reminder_date      = $num['reminder_date'];
    $reminder_date      = date_create("$reminder_date");
    echo date_format($reminder_date,"Y/m/d") ." remind<br>";

    $sub_expire_date    = $num['sub_expire_date'];
    $sub_expire_date    = date_create("$sub_expire_date");
    echo date_format($sub_expire_date,"Y/m/d") . " expire<br><br>";


I took a different approach. Discontinued this discussion.

Do you mean MySql error logs? If so, I've never understood how to do this. (I'm using a WAMP testing server).

I think you are asking if a business type letter can be made this way. Sure. You would probably format the letter in HTML, and then echo it in php so that you can include variables drawn from your database.

I have a MySQL database which contains a text field which contains well formed xml. I want to export this data as an xml file named result_new.xml on the fly. I have made the tmp folder and have set the permissions on the folder to 0777. If I run this snippet in a php file with proper access to the database and correct values in the variables, I can echo the field's content correctly, but when I use the following to create a xml file, nothing happens. I cannot find the new file in the tmp folder. Can someone give me some help here?

"SELECT Result INTO OUTFILE '/tmp/result_new.xml' FROM safetyte_stol.quiz WHERE managerId = '$managerId' AND userIdRec = '$userIdRec' AND quizTitle = '$quizTitle'";


I've narrowed the issue down to the following script.

<!DOCTYPE html>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<script src='safetytesting.js'></script>
<link rel="stylesheet" type="text/css" href="safetytesting.css">
<script type='text/xml' id='resultData'>'<?php echo $Result; ?>'; 

 <div id='report'>Loading your report... If it does not appear, make sure you have Javascript enabled in your browser. </div>
 <script>SafetyTesting.convertResultsToHTML(document.getElementById('resultData'), '../../equipment2/<?php echo $quizTitle; ?>/hotspot images', 'report')</script>
 <div> Echoed php tests follow:..Quiz title is <?php echo $quizTitle; ?> </br> Echoed Result is </br> <?php echo $Result; ?> </div>

I have a text variable collected from a database which consists of well formed xml. The variable containing the text is $Results. The seventh line of the above script attempts to insert the php variable $Result into the javascript. It is clearly not working as I have it, but the $Result variable can be echoed correctly at the end of the script. The question is, how can I express the variable $Result so that it can be read by the javascript?

I have a mysql database that has previously stored the text of an xml file including tags. I want to select that data from the database and return it as an xml file rather than just text, (eg filename.xml). It is to be further processed with a javascript file which will output as HTML. I'm no xml programmer but have been trying a couple of things and have included my most recent attempt below for constructive comment.
The file check.php selects the xml data from the database, but the display does not show any xml tags. They are there though because a view source will show them. I am expecting that if the data is selected and saved into a temporary Result.xml, the header towards the end of check.php will call the javascript file to act on the Result.xml. That's the plan, anyway.

if (isset($_SESSION['id'])) {
    $id   = $_SESSION['id'];
    $userId = $_SESSION['userId'];
    $userIdRec = $id;
    $managerId = $_SESSION['managerId'];
    $userIdRec = $_SESSION['userIdRec'];
    $quizTitle = "";
    $quizTitle = mysqli_real_escape_string($conni, $_GET['quizTitle']);
    <td>You must be logged in through the<br />
      <a href="../../index.php">Student Portal</a><br />
      to be able to check your quiz results.</td>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<meta http-equiv="Content-Type" content="text/html">
<link rel="stylesheet" type="text/css" href="style.css">
<title>Quiz Result Management Panel</title>
    //header("Content-type: text/xml");    
    $sql = "SELECT Result FROM safetyte_stol.quiz WHERE managerId = '$managerId' AND userIdRec = '$userIdRec' AND quizTitle = '$quizTitle'";
        $result = mysqli_query($conni, ...

OK Thanks.

I have the same version PHP 5.4.3 on my WAMP server and there are none of these messages.

My web host recently advised me that my site was being migrated (after the event). I am led to believe that this is in the interests of improving the service.
Immediately after the migration I discovered that one php file using date/time functions was stalling and numerous files were showing an errorWarning: phpinfo() [function.phpinfo]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Antarctica/Macquarie' for 'EST/10.0/no DST' instead in /home/safetyte/public_html/php_info.php on line 1.
After prolonged discussions, support advised me to add date_default_timezone_set('Australia/Melbourne'); immediately after session_start();. This did resolve the problem (that did not exist previously). As well as that, php.ini shows date.timezone as having no value. I raised this issue with support and was instructed to add the following to a htaccess file which I was to set up in the root.
Everything now works OK again, but I have a lingering feeling that I may have just been "sold a pup"
Can anyone who understands these things make comment?
I wonder if I've been moved to some sort of shared server.

I don't understand why this works, but I amended the php.ini to include session.save_path = "/tmp".
This points the session files to the directory specified in php_info.php.
I suspect that there is another /tmp folder somewhere, because when I now inspect the visible /tmp folder there are no session files in there, even though session files are working.
Anyway, it works now.

I can read the session.save_path from the remote server at php_info.php. It is set to "no value". I assume that this defaults to /tmp.
I understand that in the absence of some other command, this means that session variable files will be saved here.

The error message is

Warning: session_start() [function.session-start]: open(c:/wampserver/tmp/sess_prrfb9ljt01401ls8oh4un7qi5, O_RDWR) failed: No such file or directory (2) in

It's trying to open a session file using a Windows-style filepath. It might be a configuration parameter being set inside my PHP code, but a local site search of 6600 files for "wampserver" does not come up with anything.

I think this means that the live copy is trying to open a file in a path which doesn't exist, hence the error messages. I know and understand that PHP will stick to its configuration file on the web server, which will normally be the system default, but given all this I cannot explain or understand the error message looking for c:/wampserver/tmp.
What's more, if I go to my local server and amend php.ini to read session.save_path = "../../portal/woodwork_sub/sessions" for example (instead of session.save_path = "c:/wampserver/tmp"), but without creating the folder named "sessions", I then get exactly the same error message as is appearing from your server.
It seems to me that there is something wrong with the session.save_path at the remote php.ini .

I think I'll mark this thread as solved and start it again under "session:save_path error" because the original heading has become very remote from the topic.

Since my remote server was recently migrated I am receiving an error message generally which goes like this
Warning: session_start() [function.session-start]: open(c:/wampserver/tmp/sess_4bkd7oiqmi7298mhikv09447t6, O_RDWR) failed: No such file or directory (2) in /home/safetyte/public_html/portal/woodwork_sub/ws_member_profile.php on line 2
Lines 1 and 2 are
This message is coming from the remote server but refers to a folder on my local computer. This message is displayed on any computer that links to as well as several other online links, though not all.
Any help would be appreciated. My webhost isn't doing much for me.

I've been able to get error messaging working and this is really weird (to me, anyway).
The error message generally goes like this
Warning: session_start() [function.session-start]: open(c:/wampserver/tmp/sess_4bkd7oiqmi7298mhikv09447t6, O_RDWR) failed: No such file or directory (2) in /home/safetyte/public_html/portal/woodwork_sub/ws_member_profile.php on line 2
Lines 1 and 2 are
This message is coming from the remote server but refers to a folder on my local computer. This message is displayed on any computer that links to as well as several other online links, though not all.
Any help would be appreciated. My webhost isn't doing much for me.

I've had a response from support. They suggested resolving it by including
date_default_timezone_set('Australia/Victoria'); at the beginning of the offending file and that did correct the file, but I've since found error messages occurring wherever a date function is called all over the web site. I do have a php.ini in /public_html on the server and this was reading date.timezone = "Australia/Melbourne"and I tried amending it to date_default_timezone_set('UTC'); but this didn't change anything. I am convinced that something is wrong on the remote server, because it all works fine on my WAMP server.
While I don't know much about php.ini, is it possible that there is another php.ini taking preference over the php.ini file I have placed in /public_html?

I got NULL.
Both on Wamp and online server
I guess this means I go to the Web Host and ask them to load the timezone data. Is this correct?
The WAMP server is Apache but the online server is Linux.

Where do I place the query to check the server date?

Still no difference, both on online server and local server.

Thanks for your help anyway. I sure hope someone can help me out. I'm willing to post the whole code but it runs out to 270 lines.

I have to wonder if some of the PHP in those three lines has become obsolete.

I've added that line and uploaded the file. No error message.

I can give you access to the page to show what is happening.
For this exercise you can use the login with the password basil1. It's a public demo page, so no harm with the login stuff.
If you go to Click Here and log in you will get the page as displays without the three lines commented out. If you then go to Click Here you can see the page with the three lines commented out.

No error. Earlier PHP and HTML code displays OK but everything from the problem lines on displays blank.

My web host recently migrated to a new server and in the process upgraded to PHP5.4
I have a snippet that was doing timezone conversion, but since the upgrade the script stops dead on a certain line in the snippet, and though a web page is displayed, none of the content (including html) displays beyond that PHP line.
Here is the code with the problem lines commented out:

$timestamp = strtotime($create);
$dtzone = new DateTimeZone($tz);
$time = date('r', $timestamp);

/* Problem code begins here
$dtime = new DateTime($time);
$time = $dtime->format('F d, Y');
Problem code ends here*/

echo $time;

$create and $tz are values drawn from a database and are specifically a creation date for the row and a timezone. By commenting out the three lines the rest of the script proceeds OK. Can anyone see what could be wrong here. If I run it on a WAMP server using PHP v 5.4.3 the thing is fine. If you can see what is wrong an explanation as well as a correction would be most welcome. (I have no idea how to insert a block of code. Can someone enlighten me?)


First, generate a simple password like this

// simple six digit transfer code generation. Security requirement low
$len2 = 5;
while (strlen($password)<$len2+1)

You could use a simple form like this in the file

<form name = "member" action="adduser.php" method="post" >                    
<input name="given" type="text" value="<?php echo "$given"; ?>" />
<input name="userPwd" type="hidden" value="<?php echo "$password"; ?>" />
<input name="family" type="text" value="<?php echo "$family"; ?>" />
<input type="submit" name="Submit" value="Submit Form" />
</form >

to invite users to self register entering their given and family names in different text boxes. This will save you a great deal of entry work.

Next, you will have to filter the entry to prevent an injection attack and you will also probably need to process the input to standardise the entry of names to the database.
You could try something like this, which will modify the form entry data to produce a given name with the first letter in upper case and the remainder in lower case, and the family name all in upper case. The two modified entries are then joined to give a given and family name joined as a phrase.

// Filter the posted variables
$family = preg_replace("/[^A-Za-z0-9-]/", "", trim($_POST['family']));// filter everything but letters and numbers
$str = $family;
$family = strtoupper($str);//convert family name to upper case
$given = preg_replace("/[^A-Za-z0-9-]/", "", trim($_POST['given']));//filter given name/s
$given = ucwords($given);
$givfam = $given .' '. $family; //joining of given and family names
$password = $_POST['userPwd'];//generated user password posted through hidden ...

I think I agree with urtrivedi. Does your host server run a timeclock? Perhaps not.

How do I make the code that I post format correctly for human readers?

If I do this it works fine as far as it goes.

$query = mysql_query("SELECT quiz.userGroup AS q_userGroup, quiz.userDate, users.userGroup AS u_userGroup, DATE_FORMAT(quiz.addDate,'%b %e, %Y'), quiz.passState,, users.given FROM quiz, users WHERE quiz.userIdRec = AND users.userGroup IN('$g1', '$g2', '$g3', '$g4', '$g5', '$g6', '$g7') AND quiz.managerId='".$userid."' AND quiz.quizTitle ='".$_SESSION['squiz']."' AND quiz.userDate BETWEEN '".$start_raw."' AND '".$end_raw."' ORDER BY users.egroup,, users.given, quiz.userDate");

The database contains a user table and a quiz table. The above query will inform me which students have completed certain tests and shows their results over a nominated time period. The test results are held in the table quiz. So far so good.

However, if a student is lazy and does not attempt any quizzes, there are no entries for that student in the quiz table, so I want the query to tell me which names in the users table do not appear in the quiz table. The variables $g1, $g2 etc refer to student group names.
Does this make sense?