473,386 Members | 1,745 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

extract date from timestamp and compare

omerbutt
638 512MB
hi there i am making a page where customer can edit his current order, the tools i am using are mysql and php
i am using 2 tables for this
1.rage_uk_bulk_order
2.rage_uk_bulk_order_products

i have the time stamp in the 1st table rage_uk_bulk_order and all the other information in the 2nd table iall is going fine it is fetching all the records for the current user/customer but i want to display only those orders from the table that the user has ordered today not those of the previous for that i had to compare todays date with the time stamp saved in the 1st table and pick all those records and display them buit i am not getting it in the right format here is my query
THE ERROR CODE
Expand|Select|Wrap|Line Numbers
  1. Parse error: syntax error, unexpected ',' in D:\Server\htdocs\borialas\edit_bill.php on line 42
  2.  
the above line 42 is the line no 27 here on this post
[PHP]
if(isset($_GET['a']) && isset($_GET['a1'])){
$bulk_odr_prod_id=substr(base64_decode($_GET['a']),17);
$odr_bulk_id=substr(base64_decode($_GET['a1']),12);
}
$tstamp=time();
$tstamp=date("Y-m-d",$tstamp);
$mem_id="2";
$str_ordEdit="SELECT
rage_uk_bulk_order.odr_bulk_stamp,
rage_uk_bulk_order_products.bulk_odr_prod_name,
rage_uk_bulk_order_products.bulk_odr_prod_price,
rage_uk_bulk_order_products.bulk_odr_prod_qty,
rage_uk_bulk_order_products.bulk_odr_prod_length,
rage_uk_bulk_order_products.bulk_odr_prod_weight,
rage_uk_bulk_order_products.bulk_odr_prod_version,
rage_uk_bulk_order_products.bulk_odr_prod_total,
rage_uk_bulk_order_products.odr_bulk_id,
rage_uk_bulk_order_products.bulk_odr_prod_id,
rage_uk_bulk_order_products.pro_id
FROM
rage_uk_bulk_order_products,rage_uk_bulk_order
WHERE
rage_uk_bulk_order_products.bulk_odr_prod_id='$bul k_odr_prod_id'
and
rage_uk_bulk_order_products.odr_bulk_id='$odr_bulk _id'
and
'$tstamp'=".date("'Y-m-d'".,."'rage_uk_bulk_order.odr_bulk_stamp'".)."" ;
//echo $str_ordEdit;
$res_ordEdit=mysql_query($str_ordEdit) or die(mysql_error().'<br />'.$str_ordEdit);
[/PHP]
thanks for any help in advance,
regards,
omer
May 29 '08 #1
1 4792
Atli
5,058 Expert 4TB
Hi.

What are you trying to do in that line?
Incorporating the PHP date function into the MySQL query?

That won't work. PHP will need the actual value before it can format it, not just the column name in the MySQL query.

Try using the MySQL DATE_FORMAT function instead.
May 30 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Phil Powell | last post by:
I am forced to have to compare the value of some PHP timestamp with a Java-based java.util.Date.getTime() timestamp. Let me show you how they look: The Java time is returned to the PHP...
0
by: Stefan Franke | last post by:
Hi! I would like to compare a timestampfield with an offset of days, which is specified in the database for each dataset an the current date. For example: timestamp 20040403120000 offset 7
8
by: peashoe | last post by:
I have an asp page that uses a calendar.js (pop-up) file to add an exact date format in the text field (txtDDate). My problem is I need some javascript that sets an alert that does not allow them...
2
by: Campano, Troy | last post by:
Hi, I'm trying to compare a timestamp to current_timestamp but I'm having trouble. I want to compare just the date piece of my timestamp column to just the date piece of current_timestamp. ...
2
by: Russell Smith | last post by:
Timestamps support infinity. However if appears dates do not. When timestamps are cast to dates, there is no output. Is this an acceptable option or not? Below are a number of examples...
5
by: rs | last post by:
I have a table with a timestamp field which contains the date and time. ie. 9/13/2004 9:10:00 AM. I would like to split this field into 2 fields, one with just the DATE portion ie 9/13/2004 and...
2
priyan
by: priyan | last post by:
hi I am having a startdate variable with timestamp datatype. I want to extract only the date from timestamp field........ select extract('hour' from timestamp '2001-02-16 20:38:40') ...
3
by: backups2007 | last post by:
what code should I use to extract and date in a timestamp? please help. thanks in advance.
0
by: Serious_Practitioner | last post by:
Good day, and Happy New Year! I'm trying to teach myself some PHP and MySQL and the project that I've decided to build will be dependent on queries involving comparisons of dates. I'd like some...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
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,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.