RE: [PHP-DB] Getting last row, moving backwards..

2001-01-19 Thread Mark Roedel

 -Original Message-
 From: Chad Day [mailto:[EMAIL PROTECTED]]
 Sent: Friday, January 19, 2001 9:15 AM
 To: '[EMAIL PROTECTED]'
 Subject: [PHP-DB] Getting last row, moving backwards..


 I need some help selecting the last row in my database, and then
 moving backwards.. I can't just get mysql_num_rows and go back by
 1, as some of the records are missing.. the ID field might have #'s
 like 1950, 1948, 1947, 1944, etc, and I don't want it to break by
 mistakingly trying to grab 1949.  Can someone provide some help or
 a link to where in the manual what I'm doing might be explained?
 Been searching, no luck yet.  Thanks!

Wouldn't it be easier to just get them from the database in the order that
you want?

In your example, something like

select * from mytable order by id_field desc

would likely do the trick (sorting your results by the value of the ID
field, in descending order).


---
Mark Roedel| "A wise man once told me that everything in
Systems Programmer |  life is either a lesson or a joke.  Our task
LeTourneau University  |  is to figure out which is which..."
Longview, Texas, USA   | -- Chris Savage



-- 
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] Getting last row, moving backwards..

2001-01-19 Thread Chad Day

cool, that's what I think I need (the data seek bit).. I'm not displaying
them all on one page, it's like display a row, go to the next page, display
the next row, repeat.  I'll try it out, thanks a lot.

Chad

-Original Message-
From: Andrew Rush [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 19, 2001 10:26 AM
To: Chad Day
Cc: '[EMAIL PROTECTED]'
Subject: Re: [PHP-DB] Getting last row, moving backwards..



On Friday, January 19, 2001, at 10:15 AM, Chad Day wrote:

 I need some help selecting the last row in my database, and then moving 
 backwards.. I can't just get mysql_num_rows and go back by 1, as some of
the 
 records are missing.. the ID field might have #'s like 1950, 1948, 1947, 
 1944, etc, and I don't want it to break by mistakingly trying to grab
1949. 
 Can someone provide some help or a link to where in the manual what I'm 
 doing might be explained?  Been searching, no luck yet.  Thanks! 

the best thing to do is to select the results in the inverse order, by using
the desc keyword with the order by clause.

SELECT * 
FROM myTable
WHERE something='somethingElse'
ORDER BY id DESC

but if that won't work do:

$query="select ...

$result=mysql_query($query);

$rowTotal=mysql_num_rows($result);

for($i=$rowTotal; $i  0; $i=($i-1)) {

$jumpTo=mysql_data_seek($rowTotal, $result); // arguments may be in
the wrong order

$row=mysql_fetch_array($result);

}

have a great day,
andy

:: Andrew Rush :: Lead Systems Developer :: MaineToday.com ::
**
"Crippled but free, blind all the time, i was learning to see"

- J. Garcia / R. Hunter
**

The  views expressed herein are not necessarily those of my employer, but
they let me have them anyway.
-- 
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] Cookies on a Macintosh

2001-01-19 Thread Jerry

In article [EMAIL PROTECTED], 
[EMAIL PROTECTED] ("Noodles Grizzly") wrote:
 I'm using the setcookie function with the follwing.
 
 setcookie("randint", "$ran3", time()+9000);
 
 It sets the cookie, but refuses to use the variable contained within. 
  I can't find any reference to it in the books I have, nor in the 
 online manual.
 
 Anyone know why this might be happening?

What does "$ran3" contain, and why is it enclosed in quotes? (It 
shouldn't matter, but I'm interested.)

Also, how do you know it sets the cookie if it refuses to use the 
variable? How does it refuse to use the variable in a manner that lets 
you know it set the cookie?

Jerry
-- 
http://www.hoboes.com/jerry/
"Give a man a fish and you feed him for a day. Teach him to fish, and you've
depleted the lake."--It Isn't Murder If They're Yankees
(http://www.hoboes.com/jerry/Murder/)

-- 
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] Child tables in MySQL

2001-01-19 Thread Darryl Friesen



 How about creating a separate table for each user and a column in the
 main table pointing to these user preference tables

I missed the first part of this thread, so forgive me if I'm missing
something, but that seems like a very bad idea.

What if 10,000 people sign up (for whatever this service is)?  Do you really
want 10,000 tables in your database?  Is it not possible to have a single
table for users (one row per user) with preferences in that same table
(perhaps encoded somehow to save space)?  Or a table for users, one for the
different preference options, and third to join them?


- Darryl

 --
  Darryl Friesen, B.Sc., Programmer/Analyst[EMAIL PROTECTED]
  Education  Research Technology Services, http://gollum.usask.ca/
  Department of Computing Services,
  University of Saskatchewan
 --
  "Go not to the Elves for counsel, for they will say both no and yes"



-- 
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] Getting started with Oracle

2001-01-19 Thread John Coonrod

I running php4/apache under windows 2000.

What do I need installed on the computer to access my oracle server? (I 
notice it refers to oracle_home, so I obviously need to install some of the 
oracle client software on my machine).



Dr. John Coonrod, Vice President, [EMAIL PROTECTED]
The Hunger Project, 15 East 26th Street, NY, NY 10010 www.thp.org


-- 
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] More on trying to get started with Oracle

2001-01-19 Thread Cody Caughlan

This seems to be a common problem, I dont know why PHP doesnt make a note of
this on their website under the Oracle documenation.

The problem is that PHP/Apache needs to know these variables upon server
startup, not when it loads the specific PHP page.

So what you need to do is set these variables in your apache httpd.conf like
this:

SetEnv TNS_ADMIN ???
SetEnv ORACLE_HOME ???
SetEnv ORACLE_SID ???

That is all I set in my config and it works great. Then you use the
user/password on the php page, and it should work..

good luck
/cody caughlan

John Coonrod wrote:

 OK, I've now figured out how to activate the oracle commands and get php4 to
 recognize them, but I cannot get the connection to connect.  This is under
 windows 2000: I've putenv oracle_home, oracle_sid and tns_admin and
 ora_logon with the same name@tns and password that work under sqlplus - and
 ora_logon fails.

 --
 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-DB] Any good way ?

2001-01-19 Thread TV Karthick Kumar

Hi all

I have written the following code, but I dont' think it's a good way to
write like this. Is there some other way to do good programming for this ?!


**
   if ($f)
   {
$SQL .= " (FIRST_NAME like '%$f%') AND ";
   }
   if ($l)
   {
$SQL .= " (LAST_NAME like '%$l%') AND ";
   }
   if ($em)
   {
$SQL .= " (HOME_EMAIL1 like '%$em%') OR (HOME_EMAIL2 like '%$em%') OR
(WORK_EMAIL1 like '%$em%') OR (WORK_EMAIL2 like '%$em%') ";
   }

**

Any help is appreciated very much.

Thanks in adv.

~ Karthick



-- 
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] Php FAQ, QA or Knowledge Base

2001-01-19 Thread Keith Spiller

Can anyone recommend a good FAQ, QA or Knowledge Base script written in PHP?
Preferably one with an administration section and a queue for questions to be answered.

Larentium