Re: [PHP-DB] Concat 3 fields in a query
wouldn't it be $_POST['PO_Year']."-".$_POST['PO_Month']."-".$_POST['PO_Day'] ? metin [EMAIL PROTECTED] wrote: Hello I have a application that has an insert query (using a mysql database) and I am having an issue with trying to combine three fields with a dash . Here is my code can anyone please help me out with what else I need to add or point me to somewhere that explains how to combine field's in a query.. '{$_POST['PO_Year']}-{$_POST['PO_Month']}-{$_POST['PO_Day']}' Thanks- Khris -- This e-mail, including attachments, may include confidential and/or proprietary information, and may be used only by the person or entity to which it is addressed. If the reader of this e-mail is not the intended recipient or his or her authorized agent, the reader is hereby notified that any dissemination, distribution or copying of this e-mail is prohibited. If you have received this e-mail in error, please notify the sender by replying to this message and delete this e-mail immediately. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] -14 Days Ago
http://dev.mysql.com/doc/mysql/en/Date_and_time_functions.html That web page has tons of details. metin Cole S. Ashcraft wrote: I am trying to see whether a data in an array pulled from a MySQL DB (YEARMONTHDATE) is older than 14 days ago. I am trying to do this in PHP. My code looks like: if($array['due'] <= $today - 14) { echo "Assignment In Void:Assignments in the void are read-only"; require('footer.php'); exit; }. I am having problems with the math. How do I do a date subtraction without ending up with something like 20040994 (not a valid date)? Thanks, Cole -- This e-mail, including attachments, may include confidential and/or proprietary information, and may be used only by the person or entity to which it is addressed. If the reader of this e-mail is not the intended recipient or his or her authorized agent, the reader is hereby notified that any dissemination, distribution or copying of this e-mail is prohibited. If you have received this e-mail in error, please notify the sender by replying to this message and delete this e-mail immediately. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Selecting date/time from an Access database
Hello all.. I've been tasked to retrieve info from an Access database and I've been successful in selecting data and displaying it. But I do have a problem with DATE/TIME data. When I run a query asking for "TIME" data, I get the value "-1" returned. $conn = new COM("ADODB.Connection") or die("lala"); $dsn = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=FILENAME.mdb"; $conn->Open($dsn); $rset=new COM("ADODB.Recordset"); $rs=new COM("ADODB.Command"); $rs->Activeconnection=$conn; $rs->CommandText="SELECT tblBooking.ReservationID, tblBooking.DateBooking, tblRoom.Room, tblBooking.TimeeventStart, tblBooking.TimeBookingEnd FROM tblRoom INNER JOIN tblBooking ON tblRoom.ID = tblBooking.RoomID ORDER BY tblbooking.reservationid ASC"; $rset=$rs->Execute; $e= $rset->Fields(4); $d= $rset->Fields(3); $c= $rset->Fields(2); $b= $rset->Fields(1); $a= $rset->Fields(0); ?> Results: $a: 6391 $b: 954568800 $b(formatted from the timestamp above): 4/1/2000 $c: 2D (Minnesota) $d: -1 $e: -1 $a is the reservation ID $b is the timestamp $c is the room name $d is the start time $e is the end time As you can see, both $d and $e are not the correct values. I opened the Access database and checked the data and it returned the correct time. I've never had this kind of problems with MySQL, but I have to use Access in this instance. Has anyone seen this before? MORE INFO: PHP Version 4.0.6 Access 97 Thanks, metin -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] order by an average in another table (basically a "top 10" list)
Just a shot in the dark.. it may be wrong, but try it out.. "SELECT avg(rating) AS avgrating FROM ratings WHERE parent_id = '$id' ORDER BY avgrating DESC LIMIT 10" try that out.. should work. metin At 04:06 PM 6/18/2003 -0400, chris wrote: I've done a google search, but most of the results are for the part I've already figured out. People that have the "top 10" sorting usually want money for their system (one wanted an absurd $500). I'm working on a database application where users vote on how much they like a particular picture. All of the picture information is in one table, and all of the votes are within another table. The picture table's auto incrementing id is referenced in the ratings table. Displaying the actual average rating of a particular photograph is easy enough: "SELECT avg(rating) FROM ratings WHERE parent_id = '$id'" But how the heck would one select the top $n entries, ordered by the average of the photo's ratings? Ideally, I'd like the query to work in both MySQL and PostgreSQL. -- Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] another redirecting question
Hi Grant.. I've tested it and it doesn't resubmit this information a second time. I have a page called submit.php where users can upload pictures. Once they submit, it goes to submitpics.php for processing and creates a session. Then it's redirected to submit.php which reads the session and destroys it after it read it. All in all, it is as if submitpics.php never existed. metin At 10:52 AM 5/30/2003 -0500, Grant Rutherford wrote: Hi I did actually encounter that problem. However, wouldn't redirecting properly still allow the user to resubmit the information using the back button? I solved this problem a different way by setting and clearing session variables on entry and exit to a series of pages. Grant On Fri, 2003-05-30 at 10:25, Metin Kale wrote: > Well, if you're inserting some data into a database and the person > refreshes the page, it would re-insert the data again into the > database. Including the page like you did at the end wouldn't change that > fundamental problem, hence why you'd want to have it redirect to another page. > > Metin > > At 10:20 AM 5/30/2003 -0500, Grant Rutherford wrote: > >I'm very new to PHP so somebody correct me please if this is a bad > >idea... > > > >I had the same problem and I ended up just including the second page at > >the end of the first one: > > > > > >// some stuff (output if necessary) > > > >include 'nextpage.php'; > >die(); > >?> > > > >Grant > > > > > >On Fri, 2003-05-30 at 09:43, Rick Dahl wrote: > > > The scripts I need to run before I redirect automatically send output > > to the browser. I cannot alter these scripts. Is there a way around this? > > > > > > Rick > >-- > >Grant Rutherford > >Iders Incorporated > >600A Clifton Street > >Winnipeg, MB Canada R3G 2X6 > >http://www.iders.ca > >tel: 204-779-5400 ext 36 > >fax: 204-779-5444 > > > >This message is intended solely for the use of the designated > >recipient(s) and their appointed delegates, and may contain > >confidential information. Any unauthorized disclosure, > >copying or distribution of its contents is strictly prohibited. > >If you have received this message in error, please destroy it > >and advise the sender immediately by phone, email or facsimile. > > > > > >-- > >PHP Database Mailing List (http://www.php.net/) > >To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] another redirecting question
Well, if you're inserting some data into a database and the person refreshes the page, it would re-insert the data again into the database. Including the page like you did at the end wouldn't change that fundamental problem, hence why you'd want to have it redirect to another page. Metin At 10:20 AM 5/30/2003 -0500, Grant Rutherford wrote: I'm very new to PHP so somebody correct me please if this is a bad idea... I had the same problem and I ended up just including the second page at the end of the first one: include 'nextpage.php'; die(); ?> Grant On Fri, 2003-05-30 at 09:43, Rick Dahl wrote: > The scripts I need to run before I redirect automatically send output to the browser. I cannot alter these scripts. Is there a way around this? > > Rick -- Grant Rutherford Iders Incorporated 600A Clifton Street Winnipeg, MB Canada R3G 2X6 http://www.iders.ca tel: 204-779-5400 ext 36 fax: 204-779-5444 This message is intended solely for the use of the designated recipient(s) and their appointed delegates, and may contain confidential information. Any unauthorized disclosure, copying or distribution of its contents is strictly prohibited. If you have received this message in error, please destroy it and advise the sender immediately by phone, email or facsimile. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] another redirecting question
Rick, The way I "solved" this problem is to have the output sent to a variable, let's say $temp_data, create a session and store $temp_data as a session variable, redirect to another page where I can read $temp_data and have it displayed on that page by calling it. Hopefully my explanation is clear enough and suits your needs.. Metin > -Original Message- > From: Rick Dahl [mailto:[EMAIL PROTECTED] > Sent: 30 May 2003 15:43 > To: [EMAIL PROTECTED] > Subject: [PHP-DB] another redirecting question > > > The scripts I need to run before I redirect automatically > send output to the browser. I cannot alter these scripts. > Is there a way around this? > > Rick > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] A Doubt
Could you enable a session variable to keep track of it? If you have an "if" statement in mnop.php that calls the abcd.php page, then have that "if" statement also start a session and register a variable. This way, if the variable you set is equal to a certain value, then you know that abcd.php was called from mnop.php. metin At 03:44 PM 8/28/2002 +, Manoj Japher wrote: >hi, > I have a question. Hoping someone may help me out. > > Can a PHP page say file "abcd.php" access a variable $xyz which is >used in another file "mnop.php"? I mean can I refer to a variable >whose value has been set in some other file. > The point is that the file "mnop.php" after finishing its query and >on a particular case loads "abcd.php". > > The reason is, I need to check everytime the file "abcd.php" is >loaded, I should be able to determine that it was loaded by "mnop.php" >and not by typing in the complete URL to "abcd.php" on the Web Browser. > >Hoping someone could tell me how if it is possible > >Best Regards, > >Manoj > > >'I have miles to go before I sleep, and promises to keep' > >-- >PHP Database Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php