RE: [PHP-DB] Newbie : URGENT : SELECT ... AS

2001-04-14 Thread Francois Legare

try using single quotes instead of double quotes:

SELECT firstname, surname, dob,
floor((to_days(curdate())-to_days(DOB))/365)
AS age FROM artistes WHERE age = '25';

Francois Legare
[EMAIL PROTECTED]
Vancouver BC Canada
604.261.1320

 -Original Message-
 From: Matt Coyne [mailto:[EMAIL PROTECTED]]
 Sent: April 14, 2001 5:07 AM
 To: PHP DB
 Subject: [PHP-DB] Newbie : URGENT : SELECT ... AS


 Hi all

 I am trying to make searches based on the age of a person. The db contains
 only the Date of Birth.

 So...

 My first attempt was to try the following :
 (this is all done in the command line on Win2000)

 SELECT firstname, surname, dob,
 floor((to_days(curdate())-to_days(DOB))/365)
 AS age FROM artistes;

 This works and returns all the values with the addition of an age column
 with what appears to be the correct age.

 However...

 When I try adding a WHERE clause:

 SELECT firstname, surname, dob,
 floor((to_days(curdate())-to_days(DOB))/365)
 AS age FROM artistes WHERE age = "25";

 I get ERROR 1054: Unknown column 'age' in 'where clause'

 How am I to use this 'virtual' age column in my searches?

 I want to be able to search on exact and age ranges plus display
 the age in
 the returned results.

 Any ideas/feedback truly welcome, I am 'under the cosh' to get this done
 asap!!! (as usual)

 TIA

 matt


 //t  h  r  e  e  z  e  r  o :   :   :

 the mill, millstone lane, leicester, le1 5jn
 e : [EMAIL PROTECTED] ::  w : www.threezero.co.uk
 t : 0116 225 0662 ::  m : 07747 845690

 :   :   :t  h  r  e  e  z  e  r  o//


  From: Paul Burney [EMAIL PROTECTED]
  Date: Wed, 11 Apr 2001 19:07:02 -0700
  To: Mike Baerwolf [EMAIL PROTECTED], [EMAIL PROTECTED]
  Subject: Re: [PHP-DB] select substring_index
 
  on 4/11/01 7:48 PM, Mike Baerwolf at [EMAIL PROTECTED] wrote:
 
  SELECT substring_index( body, ".  ", 2) FROM news;
 
  This works great from the mysql client but when I try it using php with
  this:
 
  $result = mysql_query("SELECT substring_index(body, "." ,2) FROM news"
 
  The way you have this written, PHP is using the . for
 concatenation.  To fix
  the problem you need to alternate or escape the quotes, i.e. :
 
  $result = mysql_query("SELECT substring_index(body, \".\" ,2) FROM news"
 
  or
 
  $result = mysql_query('SELECT substring_index(body, "." ,2) FROM news'
 
  or
 
  $result = mysql_query("SELECT substring_index(body, '.' ,2) FROM news"
 
  Hope that helps,
 
  Paul Burney
  http://paulburney.com/
 
 
  --
  PHP Database Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail: [EMAIL PROTECTED]
 
 


 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DB] Moving database info?

2001-04-14 Thread Francois Legare

dump the structure and data of the first table and db (on the main page
youll find a section for that) take the sql text (ie "CREATE TABLE etc" and
"INSERT INTO etc") and paste it into the "Run SQL query" text area of the
second db

Francois Legare
[EMAIL PROTECTED]
Vancouver BC Canada
604.261.1320

 -Original Message-
 From: Matthew Cothier [mailto:[EMAIL PROTECTED]]
 Sent: April 14, 2001 10:54 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Moving database info?


 Does anyone know how I can move tables from one database to another using
 phpmyadmin?

 Please help, thanks!

 _
 Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.


 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DB] odbc_fetch_row

2001-04-13 Thread Francois Legare

maybe you could try odbc_num_rows($yourResultID)
this will return 0 if there is nothing in the result set or the number of
rows otherwise

look in the php manual for more info
http://www.php.net/manual/en/function.odbc-num-rows.php

note that it might return -1 (thus not work as intended) with some drivers,
look in the user contributed notes at the bottom of the manual page, there
seems to be a few solution to that -1 problem

Francois Legare
[EMAIL PROTECTED]
Vancouver BC Canada
604.261.1320

 -Original Message-
 From: Randall Barber [mailto:[EMAIL PROTECTED]]
 Sent: April 13, 2001 3:30 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] odbc_fetch_row


 When I run a query, even if it is empty I still get a valid
 identifier for the result.

 How do I determine that there is nothing in the result, even
 though the result is valid (just empty)?

 I thought about odbc_fetch_row, but that moves the pointer
 forward and I don't want that; there may be valid info.
 I tried odbc_result'ing a COLUMN and it returns NULL not error,
 so I can't test against that.

 One thought is to see if all columns in my query are NULL and
 then "No rows were found".  Is there a simpler way?

 How does odbc_result_all determine there is nothing present?

 Thanks
 RDB



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] How to get rid of $PHP_AUTH_USER value?

2001-03-13 Thread Francois Legare

I would like to make a php script that remove the values associated with
$PHP_AUTH_USER and $PHP_AUTH_PW whenever a user accesses it. I tried
unset($PHP_AUTH_PW), i tried sending a 401 header with the No cigar
statement in it (header('HTTP/1.0 401 No cigar')) but it doesn't work: i
still get in the site without being ask for my uname/pword. Does anyone know
a way to get rid of $PHP_AUTH_USER and $PHP_AUTH_PW?

thank you very much

Francois Legare
[EMAIL PROTECTED]

p.s.: the requirements forbid me from using an html form to authenticate our
users


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]