I'm getting - parse error, unexpected T_LNUMBER - error messages referring to the last "if" lines of this code.
What I'm trying to do is check the database and if this user's article row isn't empty AND the article that's in there isn't older than 90 days then execute the "if" clause. I've tried it two different ways and neither of them work. The trouble must be with this since it is in both ways that I've tried:
[PHP]$posted > SUBDATE(NOW(), INTERVAL 90 DAY)[/PHP]
The first way:
[PHP]if (isset($_SESSIO N['user_id']))
{
$query = "SELECT article, posted, FROM articles where user_id='".$_SE SSION['user_id']."'";
$result = mysql_query($qu ery);
while($row = mysql_fetch_arr ay($result, MYSQL_ASSOC))
{
$article = stripslashes($r ow['article']);
$posted = $row['posted'];
}
if ($article != '' && $posted > SUBDATE(NOW(), INTERVAL 90 DAY))
{[/PHP]
Other way:
[PHP]$query = "SELECT article, posted, FROM articles where user_id='".$_SE SSION['user_id']."'";
$result = mysql_query($qu ery);
while($row = mysql_fetch_arr ay($result, MYSQL_ASSOC))
{
$article = stripslashes($r ow['article']);
$posted = $row['posted'];
}
if ($article == '')
{
echo "";
}
elseif ($posted < SUBDATE(NOW(), INTERVAL 90 DAY))
{
echo "";
}
else
{[/PHP]
2 1250
I also tried this, but received the same error message concerning line #10 below:[PHP]$query = "SELECT article, posted, FROM articles where user_id='".$_SE SSION['user_id']."'";
$result = mysql_query($qu ery);
while($row = mysql_fetch_arr ay($result, MYSQL_ASSOC))
{
$article = stripslashes($r ow['article']);
$posted = $row['posted'];
}
if ($article != '')
{
if ($posted > SUBDATE(NOW(), INTERVAL 90 DAY))
{
echo "
<!-- Form Goes Here -->
";
}
}
else
{
echo "";
}[/PHP]
pbmods 5,821
Recognized Expert Expert
Heya, David. - SUBDATE(NOW(), INTERVAL 90 DAY)
is SQL, not PHP.
Instead you'll want to do this:
(there are 7,776,000 seconds in 90 days)
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Alejandro Forero Cuervo |
last post by:
Hello.
I'm new to PostgreSQL and I'm using it for some project. I
am currently creating an entity engine that provides a web
interface, which is oriented towards end users, to the database
based on some enriched description of the tables (from which it
also generates the SQL code to create them).
My application ...
|
by: Walter Dnes (delete the 'z' to get my real address |
last post by:
A long time ago, in a place far away, there was an OS called DOS that
had standard numeric return codes. Regardless of the programming
language used, the same error return codes were supposed to be used. See
http://www.felgall.com/doserr.htm for a larger list. It starts like so...
# 1 Invalid Function Code
# 2 File Not Found
# 3 Path...
|
by: Johnny Google |
last post by:
Here is an example of the type of data from a file I will have:
Apple,4322,3435,4653,6543,4652
Banana,6934,5423,6753,6531
Carrot,3454,4534,3434,1111,9120,5453
Cheese,4411,5522,6622,6641
The first position is the info (the product) I want to retreive for the
corresponding code. Assuming that the codes are unique for each product
and all...
|
by: yawnmoth |
last post by:
I have two servers that have had PHP installed on them and...
<?php
echo 'hello, world!
?>
....displays a parse error on server A and doesn't display anything on
server B.
Any ideas as to what the problem is?
|
by: Michael B. Trausch |
last post by:
Alright... I am attempting to find a way to parse ANSI text from a
telnet application. However, I am experiencing a bit of trouble.
What I want to do is have all ANSI sequences _removed_ from the output,
save for those that manage color codes or text presentation (in short,
the ones that are ESChttp://fd0man.theunixplace.com/Tmud.tar
which...
| |
by: starke1120 |
last post by:
I have a table (tblVAS) that contains a field called VAS (Value Added
Servies). This field is imported from an AS/400 and the filed contains
several codes that relate to Value Added Services. The problem is that
they are not ALWAYS seperated with a space, but sometimes are.
I am in need of query the field and matching up the codes to the...
|
by: AdrianH |
last post by:
Assumptions
I am assuming that you know or are capable of looking up the functions I am to describe here and have some remedial understanding of C programming.
FYI
Although I have called this article “How to Parse a File in C++”, we are actually mostly lexing a file which is the breaking down of a stream in to its component parts,...
|
by: karinmorena |
last post by:
I'm having 4 errors, I'm very new at this and I would appreciate your input. The error I get is:
Week5MortgageGUI.java:151:cannot find symbol
symbol: method allInterest(double,double,double)
Location: class Week5MortgageGUI
Week5MortgageLogic allint = logic.allInterest(amount, term, rate);
Week5MortgageGUI.java:152:cannot find symbol...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
| |
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| |