Re: [PHP-DB] Re: Regular Expression

2004-04-18 Thread Kelly Hallman
Apr 18 at 11:01pm, Andy Ladouceur wrote:
> Andy Amol wrote:
> > I would like to test whether a given sting contains only character, it
> > should also support spaces. eg "Course Book String". I am able to test
> > "CourseBookString". Also I would like to know how can we avoid wild
> > chars like *, or any other char apart from alpha numeric char.
>
> A regexp like this should work:
> /^([a-zA-Z]|\s)+$/

/^[A-Za-z\s]+$/ would be a better way of putting it.
however, \s would match tabs (also CR and/or LF in some regex engines).

to only alpha or space, this would work best:
/^[A-Za-z ]+$/

-- 
Kelly Hallman

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Re: Regular Expression

2004-04-18 Thread Andy Ladouceur
A regexp like this should work:

/^([a-zA-Z]|\s)+$/

Cheers,
Andy Ladouceur
Andy Amol wrote:

Hi,
   I would like to test whether a given sting contains only character, it should also support spaces.
eg "Course Book String". I am able to test "CourseBookString".
 
Also I would like to know how can we avoid wild chars like *, or any other char apart from alpha numeric char.
 
Thanks.


-
Do you Yahoo!?
Yahoo! Photos: High-quality 4x6 digital prints for 25¢
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] How to write file & store file-name to DB...

2004-04-18 Thread Marcjon Louwersheimer
http://ca2.php.net/manual/en/ref.filesystem.php
Look here for write or fwrite. That should be what you want.
-- 
  Marcjon

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] How to write file & store file-name to DB...

2004-04-18 Thread Sukanto Kho
Hi, I want to save pages that show records for each user's identity, to HTML
files then add the file-name to database..

Each page contain information of certain user..

How to save page to HTML file with PHP...??

Nicholas Sk2

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Regular Expression

2004-04-18 Thread andy amol
Hi,
   I would like to test whether a given sting contains only character, it should also 
support spaces.
eg "Course Book String". I am able to test "CourseBookString".
 
Also I would like to know how can we avoid wild chars like *, or any other char apart 
from alpha numeric char.
 
Thanks.


-
Do you Yahoo!?
Yahoo! Photos: High-quality 4x6 digital prints for 25¢

[PHP-DB] Re: Double Submission into DB if Hit Refresh

2004-04-18 Thread Torsten Roehr
"Craig Hoffman" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> What is the best way to avoid data being resubmitted (entered twice) to
> DB (mysql) if the user hits refresh after POSTING data via a form?

You can make it even more easy for inserts by using the SQL command IGNORE.
Just make the column with the unique transaction ID your primary key or (if
you don't use a auto-increment column) make your id column the primary key
and use:

INSERT IGNORE INTO table ...

So the record is only inserted if the primary key doesn't exist yet and just
ignores multiple inserts with the same id. This should work for MySQL - I
don't know if it works for other DBs as well.

I don't see a problem for multiple updates as the data usually won't change
between the refresh.

Regards, Torsten Roehr

> __
> Craig Hoffman - eClimb Media
>
> v: (847) 644 - 8914
> f: (847) 866 - 1946
> e: [EMAIL PROTECTED]
> w: www.eclimb.net
> _

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Storing route in DB

2004-04-18 Thread Robert Ian Smit
Hi,

I am not sure if my issue can be partially solved by a good database
design or that all stands or falls with the application.

If I have a bunch of locations in a table and I want to describe a
route between a number of these locations, what's the best way to do
it, considering  that it must be possible to change the route
afterwards. For instance (A-B-C-A, becomes A-C-B-A).

Ofcourse it's not a really big problem to solve in PHP. However I
believe it would be best if the database enforced some rules about
how a route may look. For instance no matter what any user or 
application does, it should not be possible to store a route
that looks like A-B-B-A or like A-B- -A or lose all route
information when there are still bookings.

Logically the problem is not too difficult, however I am looking for
a way to implement this in MySQL/PHP. Any pointers to help me in my
analysis would be much appreciated.

Bob

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php