Re: [PHP] XML Parsing Problem

2002-01-03 Thread Ben Gollmer

Huh - I guess it could be useful. I still think this should be an option 
you could set with xml_parser_set_option(), or something.

In case anyone is interested, I solved the problem by creating a new 
global variable, $previousTag. Each time my character parsing function 
is called, it compares the previous tag to the current tag. If they are 
the same, the data gets stuffed into a buffer; if they are different, 
the buffer is returned, cleared, and the new data stuffed into it...and 
$previousTag is set to the current tag.


Ben

On Wednesday, January 2, 2002, at 06:41 PM, Matthew Clark wrote:

 well thats just the way XML parsers work, according to the parser, what 
 you
 have there is not a single string element, you have three child elements
 (the parent node being the title).. two string nodes broken up by an
 entity node.  In other circumstances, this behaviour can be very useful.

 Matt.


 -Original Message-
 From: Ben Gollmer [mailto:[EMAIL PROTECTED]]
 Sent: 02 January 2002 23:16
 To: [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Subject: Re: [PHP] XML Parsing Problem


 Ok, I can understand the predefined entity replacement. But why does it
 break the string up into 3 parts? I think it should just return
 Follow-up To Critique of BeOS amp; Mac OS X.

 Ben





-- 
PHP General 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] XML Parsing Problem

2002-01-02 Thread Ben Gollmer

Ok, I can understand the predefined entity replacement. But why does it 
break the string up into 3 parts? I think it should just return 
Follow-up To Critique of BeOS amp; Mac OS X.

Ben


On Wednesday, January 2, 2002, at 02:05 PM, Matthew Clark wrote:

 Hi there,

 This is not a bug.. this is expected behaviour.

 The string would be chopped up into 3 parts because you have :

 1. a string: Follow-up To Critique of BeOS 
 2. a predefined entity : amp;
 3. a string: amp; Mac OS X

 There are not actually two ampersands.. you have amp; followed by 
 amp; -
 this is so that once it has been parsed you end up with amp; which will
 display correctly in most HTML browsers.

 Note that amp; is a usually a predefined entity in XML and so will be
 replaced with .

 HTH

 Matt.

 -Original Message-
 From: Ben Gollmer [mailto:[EMAIL PROTECTED]]
 Sent: 01 January 2002 00:23
 To: [EMAIL PROTECTED]
 Subject: [PHP] XML Parsing Problem


 Hi all -

 I'm experimenting with PHP's XML parser for an application that maps XML
 tags to MySQL database fields.

 As a test for my parsing program, I've been grabbing XML from the
 Slashdot news feed (http://www.slashdot.org/slashdot.xml) and inserting
 it into a database. This is very simple data - titleblah/title gets
 inserted into the 'title' field, etc. However, when there are some
 strange characters in the title field, the XML parser seems to choke.

 Here is an example. The title of a recent article from Slashdot looks
 like this in the XML file:

 titleFollow-up To Critique of BeOS amp;amp; Mac OS X/title

 Don't ask my why they have a double ampersand in there... Anyway, the
 XML parser returns this as three sets of data, instead of one. The array
 that I get looks like this:

 $myArray[0] = Follow-up To Critique of BeOS 
 $myArray[1] = 
 $myArray[2] = amp; Mac OS X

 This is the data I get back from the parser, BEFORE putting it into the
 database. I'm echoing each array field to the screen, just to make sure.
 So I know it has nothing to do with MySQL. The double ampersand
 shouldn't make a difference - the XML parser should not be interpreting
 HTML...right? Also, I don't get an error code or error string from
 xml_parse().

 Anyone have any ideas? This is a subtle bug - in fact I had been
 satisfied with my XML parsing code, and was well into the rest of my
 application when I happened to notice this.

 Ben


 --
 PHP General 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 General 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 General 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] XML Parsing Problem

2001-12-31 Thread Ben Gollmer

Hi all -

I'm experimenting with PHP's XML parser for an application that maps XML 
tags to MySQL database fields.

As a test for my parsing program, I've been grabbing XML from the 
Slashdot news feed (http://www.slashdot.org/slashdot.xml) and inserting 
it into a database. This is very simple data - titleblah/title gets 
inserted into the 'title' field, etc. However, when there are some 
strange characters in the title field, the XML parser seems to choke.

Here is an example. The title of a recent article from Slashdot looks 
like this in the XML file:

titleFollow-up To Critique of BeOS amp;amp; Mac OS X/title

Don't ask my why they have a double ampersand in there... Anyway, the 
XML parser returns this as three sets of data, instead of one. The array 
that I get looks like this:

$myArray[0] = Follow-up To Critique of BeOS 
$myArray[1] = 
$myArray[2] = amp; Mac OS X

This is the data I get back from the parser, BEFORE putting it into the 
database. I'm echoing each array field to the screen, just to make sure. 
So I know it has nothing to do with MySQL. The double ampersand 
shouldn't make a difference - the XML parser should not be interpreting 
HTML...right? Also, I don't get an error code or error string from 
xml_parse().

Anyone have any ideas? This is a subtle bug - in fact I had been 
satisfied with my XML parsing code, and was well into the rest of my 
application when I happened to notice this.

Ben


-- 
PHP General 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] Updating Timestamps

2001-11-26 Thread Ben Gollmer

The easiest way is to use an SQL query like this;

update your_table set timestamp_field=null;

This sets the timestamp to the current time automagically. You can of 
course add a where clause and so on to this query.

Ben


On Monday, November 26, 2001, at 09:27 PM, cosmin laslau wrote:

 I'm using timestamps (God bless the little things) to keep track of 
 database updates, so to give users the latest updates by the second. 
 Kinda neat. But anyway, the timestamps are in one table, and when 
 something is that table is changed, it automatically updates.

 However, I have another table which I want to affect the timestamps. Is 
 there a command for 'manually' updating a timestamp rather than by 
 SQL's own logic?

 Thanks in advance.

 Cosmin Laslau

 _
 Get your FREE download of MSN Explorer at 
 http://explorer.msn.com/intl.asp


 -- PHP General 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 General 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] Parsing XML

2001-11-13 Thread Ben Gollmer

Do something like this:

function parseXML($xmlFile)
{
$theParser = xml_parser_create();
xml_set_element_handler($theParser, startElementHandler, 
endElementHandler);
//parse your XML here

return $attributeArray;
}

function startElementHandler($theParser, $theTag, $theAttrs)
{
global $attributeArray;

//do your attribute handling here; maybe something like this
$attributeArray[] = $theAttrs;
}


Ben


On Tuesday, November 13, 2001, at 07:34 PM, Michael Harris wrote:

 Can anybody tell me if there is a way to build an array or some other
 means of collecting the attributes from the Start Element Handler so I
 can return them back to my main application?

 Thanks for any help,
 -Mike


 --
 PHP General 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 General 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] Parsing XML

2001-11-13 Thread Ben Gollmer

Oops, forgot a line:

On Tuesday, November 13, 2001, at 08:58 PM, Ben Gollmer wrote:

 Do something like this:

 function parseXML($xmlFile)
 {
global $attributeArray;

   $theParser = xml_parser_create();
   xml_set_element_handler($theParser, startElementHandler, 
 endElementHandler);
   //parse your XML here

   return $attributeArray;
 }

 function startElementHandler($theParser, $theTag, $theAttrs)
 {
   global $attributeArray;

   //do your attribute handling here; maybe something like this
   $attributeArray[] = $theAttrs;
 }


 Ben


 On Tuesday, November 13, 2001, at 07:34 PM, Michael Harris wrote:

 Can anybody tell me if there is a way to build an array or some other
 means of collecting the attributes from the Start Element Handler so I
 can return them back to my main application?

 Thanks for any help,
 -Mike


 --
 PHP General 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: php-list-
 [EMAIL PROTECTED]




 -- PHP General 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 General 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] Port Scanner

2001-08-20 Thread Ben Gollmer

Make sure you pass fsockopen() the optional timeout parameter, and that 
the timeout is less than the maximum script execution time.

See http://www.php.net/manual/en/function.fsockopen.php

Ben

On Monday, August 20, 2001, at 12:49 PM, brian ellis wrote:

 When I use the fsockopen command onto an IP address that does not
 exist, the page will freeze until it's execution time is up. Right now
 I have it executing the external ping command and reading the results
 from that. Does anyone have a better idea using maybe a OS-independent
 scanner or some code to remove that process?

 Thank Ye Kindly
 Brian

 --
 PHP General 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 General 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] PHP 4.0.6 + GD 2.0.1

2001-06-23 Thread Ben Gollmer

Hi all-

Is anyone using PHP 4.0.6 with GD 2.0.1? (yes I like to live on the 
bleeding edge :-)

I'm developing an application that does a lot of image operations and 
would like to be able to use the new ImageCopyResampled() and 
ImageCreateFromString() functions.

I'm using PHP 4.0.6 with GD 1.8.4 right now, and all is well. However, 
when I install GD 2.0.1, PHP's make dies, saying there is something 
wrong with gdio.h. I've removed all GD 1.8.4 bits from my box, just in 
case there is a library conflict; and the --with-gd-[DIR] is set 
correctly during PHP's ./configure, but make still goes kablooey.

TIA,

Ben Gollmer


-- 
PHP General 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] Uptime script?

2001-05-16 Thread Ben Gollmer

Uptime.exe is available on the WinNT / Win2k resource kit. You can also 
download it here:

http://www.microsoft.com/ntserver/nts/downloads/management/uptime/default.
asp

On NT, you need at least Service Pack 4 to run it.


Ben


On Wednesday, May 16, 2001, at 01:55 PM, Ryan Christensen wrote:

 That's what I was wondering.. hehe.. I just want to be able to show 
 users
 that the server is stable.. (this is for a server-status page.. shows
 general information.. only for members of the site anyways.)

 Ryan

 -Original Message-
 From: Christian Reiniger [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, May 16, 2001 11:19 AM
 To: Matthew Schroebel; [EMAIL PROTECTED]
 Subject: Re: [PHP] Uptime script?


 On Wednesday 16 May 2001 15:16, Matthew Schroebel wrote:
 Why would you want to advertise that?  Seems like you would be leaking
 information to crackers ...

 It's very difficult to imagine how 'uptime' information could be used 
 to
 cause mischief...

 chris@server:~$ uptime
   8:55pm  up 45 days, 13:42,  1 user,  load average: 0.07, 0.03, 0.00

 --
 Christian Reiniger
 LGDC Webmaster (http://sunsite.dk/lgdc/)

 ...1000100011010101101010110100111010113...

 --
 PHP General 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: php-list-
 [EMAIL PROTECTED]




 --
 PHP General 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 General 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] PHP priviledges

2001-05-14 Thread Ben Gollmer

This is an excellent question. I've run into the same thing myself when 
setting up my own Linux boxen.

Apache + PHP needs to have read access to users' web directories in 
order to serve them up to the 'net (mode 704), and directories must have 
the execute bit set (mode 705). Assuming users with virtual hosts are 
all members of a group (say 'vhusers'), a shell user cannot read other 
users' files. However, a PHP script (running as the Apache user - 
usually 'nobody') can read all files, obtain directory listings, etc etc 
(as can anyone not a member of the 'vhusers' group - on a virtual host 
server, I'm guessing no one should have priviledged access except the 
admins).

Obviously, this is undesirable from a security standpoint. You don't 
want some luser snarfing the code you've been working on for weeks!

One suggestion I've heard is to make each user have their own group, for 
example 'joeuser' belongs to the group 'joeuser', etc etc. Then you 
could start a seperate instance of Apache+PHP for each user - running AS 
that user. Now joeuser's PHP scripts can't read bobuser's files. 
However, in my view this opens up another security hole - external 
services should never run as normal users on a box. If a new buffer 
overflow was found in Apache, someone could easily wipe out joeuser's 
files...whereas in the previous example, the damage would be limited to 
just reading the files. Also, starting so many instances of Apache seems 
unnecessarily resource-intensive.

I'm by no means a security expert - this email merely reflects the 
results of experimentation on my own boxen. If anyone has any 
suggestions on how to improve this situation, please post 'em!

Ben Gollmer


On Monday, May 14, 2001, at 01:09 PM, bd wrote:

 Hello,

 I have similar concerns with the host I'm trying out right now - though
 they're running Linux/Apache.  My problem is with lack of security with
 shell access (i.e. access to other client's directories and key server
 files) and apparently lax monitoring of its privacy policies.  I'm not 
 a sys
 admin so I don't know exactly what is achievable, but I was surprised 
 by the
 loose config of the server I'm on.

 I'm looking for a Virtual-Host provider running PHP/MySQL who has 
 mastered
 the concept of providing a secure, shared environment to it's clients -
 including ssh/scp access restricted to only what's owned by me, secured
 administration tools, secured email communication with its clients, and
 complete logical and physical security of the server and data center.  
 Does
 anyone have a recommendation?  I've seen providers that address these 
 issues
 for dedicated server configs - but not virtual server configs.

 Best Regards,
 bd

 -Original Message-
 From: José León Serna [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, May 09, 2001 6:57 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] PHP priviledges


 Hello:
 In my host, the php is installed in a way that I have access from a 
 php
 script to all the webs on that server, (there are almost 60) and I can
 delete/copy any file of other servers. I don't like this because other 
 user
 of that server can do the same as I. I have contacted with my host and 
 they
 doesn't know how to prevent php/IIS to have access to other directories 
 on
 the server, Is this possible?

 Best Regards
 
 Visual PHP Studio, RAD development with PHP
 http://www.visualphpstudio.f2s.com



 --
 PHP General 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 General 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 General 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] need some ideas here...

2001-05-14 Thread Ben Gollmer

If you have an account on a remote host, you can always do something 
like this:

?php
include(http://www.remotehost.com/~myaccount/mailfunction.inc;);

mymail($to, $mailbody);
?

where mailfunction.inc has the mymail function defined to just take your 
parameters and stuff them into the standard mail().

Of course include()ing from remote hosts can be disabled when compiling 
PHP, and if your host is really evil, the will have disabled this too.

Your last resort is to create your own mail function by fsockopen()ing a 
connection to port 25 of your SMTP server and sending raw SMTP commands. 
This would require some reading of the relevant mail RFCs...but is 
definitely feasible.


Ben Gollmer


On Monday, May 14, 2001, at 07:04 PM, Christian Dechery wrote:

 My free-web-hosting (www.f2s.com) does not allow PHP to send emails... 
 I've tried everything... the mail() function, my alternate function 
 which calls popen(/usr/lib/sendmail -t) and even a script.cgi with 
 '#!/usr/bin/php' and all that stuff...

 the mail simply won't go an mail() always returns false...
 I'm guessing there's no mail sending in this server...

 so what do I do?

 is it possible for me to call a script on another host from with a 
 script and return something to it?

 like
 ?php
 code ... code ... code...;
 code ... code ... code...;

 here I'd have some code to call a script in another host that can send 
 mails, of course with the necessary parms...;

 code code code;
 code code code;
 ?
 
 . Christian Dechery (lemming)
 . http://www.tanamesa.com.br
 . Gaita-L Owner / Web Developer


 -- PHP General 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 General 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] need some ideas here...

2001-05-14 Thread Ben Gollmer

On Monday, May 14, 2001, at 10:00 PM, Chris Adams wrote:

 On 14 May 2001 19:04:43 -0700, Ben Gollmer [EMAIL PROTECTED] wrote:
 If you have an account on a remote host, you can always do something
 like this:

 ?php
  include(http://www.remotehost.com/~myaccount/mailfunction.inc;);

  mymail($to, $mailbody);
 ?

 where mailfunction.inc has the mymail function defined to just take 
 your
 parameters and stuff them into the standard mail().

 Wouldn't this still run the code on the local server with the 
 dysfunctional
 mail() command?

You are right - brain fart. Whomever suggested GETing or POSTing the 
mail text to a remote script earlier was correct. : )

Ben

-- 
PHP General 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] PHP 4.0.5 Parse Problems

2001-05-07 Thread Ben Gollmer

Hi all -

Today I compiled and installed PHP 4.0.5 on my Linux server (Apache 
1.3.19, linked statically with php  mod_ssl). Suddenly, many of my 
files would no longer be parsed by PHP - instead, they spit raw code 
onto the page.

I created most of the files on my MacOS X machine using the text editor 
Pepper. Some were also created on Windows 2000 using Notepad. Previously 
I noticed a post to this list noting a problem with line endings:

With 4.0.4pl1 and earlier, this did not occur, but with 4.0.5, there
are some files on our server that are not getting parsed as php, and
just showing up as the code itself.  The problem files are a mess, but
I only mention them since they got parsed before.  They are php files
that the designers here have created in HomeSite and saved as PC
format, so they are basically 1 long line when I open them in vi, and
have ^M's everywhere.  If they pull them back into HomeSite and save
as UNIX format and upload, no problem.  What changed in PHP that would
make this difference.  I would just tell them to do this with all the
problem ones, but there are a lot.
This is on OpenBSD, btw.  Thanks.
-Ken

I tried changing the line endings of some of my files, but to no avail. 
The only thing that seems to work for me is to create a new file using 
vi or pico - PHP then parses it perfectly. For now, PHP 4.0.5 isn't a 
must-have upgrade, so I went back to 4.0.4pl1.

Is this a bug, or some change in PHP that is causing it to ignore 
alternative (non-UNIX) line endings? If there is a problem with PHP, I 
want to make sure everyone is aware of it so it can be fixed in 4.0.6.

Ben Gollmer

-- 
PHP General 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] Retrieve item from table at random

2001-02-07 Thread Ben Gollmer

I've got a better way yet:

select RAND() as rand_col, column_name from table_name order by rand_col

Only one query for randomized results, no PHP/Perl/etc. You can of course 
add the 'limit 1' on the end to get one row back. I use this method a lot - 
my main server is running 3.22.32 but my test server always has the latest 
version installed, and this way my code is compatible across all versions.

Ben

At 10:50 PM 2/6/2001, you wrote:
"David Robley" [EMAIL PROTECTED] wrote:
  On Wed,  7 Feb 2001 11:28, enthalpy wrote:
   anyone have example code for randomly grabing an item from a mysql
table?
  
 
  Mysql 3.23 will let you order by RAND() and you could use a LIMIT to
  restrict to one result. I haven't tried it, though.

I can confirm that what David suggested does work.  If you're using an older
MySQL you can do something like the following.  It requires two queries
instead of one.  First return all records and count # of records (alternate
method is to just use an SQL count() statement), then generate a random # in
PHP b/w 0 and the # of records, then use an SQL quuery with LIMIT
random_row_number, 1 (return 1 record).

$result = mysql_query( $sql, $handle ) or die( "No records." );
$result_num_records =  mysql_num_records( $result );

srand( ( double ) microtime() * 100 );
$row_offset  = rand( 0, $result_num_records );

$sql = "SELECT * FROM my_table LIMIT $row_offset, 1 ";

--
Steve Werby
COO
24-7 Computer Services, LLC
Tel: 804.817.2470
http://www.247computing.com/


--
PHP General 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 General 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]