You are asking me to calm down, when you are telling me there is no db connection. There is, I just don't see the need to put it in here, when the connection is fine, and the query is fine.
This is a new attempt at the query within the connection:
Code: Select all
echo "<td valign='top'>";
if ($row->received == NULL) { echo "$row->id";}
elseif ($row->received != NULL) {echo "<a href='index.php?page=returnid&id=$row->id&head=$row->website item returned'>$row->id [view]</a>";}
$datesubmitted = strtotime($row->received);
$addedDays = strtotime('+14 days', $datesubmitted);
$today = (date("Y-m-d"));
$thedate = strtotime($today);
$result = ($thedate - $addedDays);
if ($result > "0") { echo "Fail";}
elseif ($result <= "0") { echo "Success";}
echo "</td><td valign='top'>$row->itemname</td>
<td valign='top'>$row->firstname $row->lastname<br/>$row->orderid</td>
<td valign='top'>$row->website</td>
<td valign='top'>$row->datecustreturned</td>
<td valign='top'>";
It's the area in the middle from $datesubmitted to echo "Success";} that is erroring.
If I take it out, it works. If I leave it in, I get this:
Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in /usr/local/psa/home/vhosts/shop.co.uk/httpdocs/support/includes/returnstst.inc on line 145
Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /usr/local/psa/home/vhosts/lshop.co.uk/httpdocs/support/includes/returnstst.inc on line 200
Line 145 is this:
Code: Select all
while ($row = mysql_fetch_object($result))
Running this query to calculate days works on it's own. Just not here for some reason.