RE: [PHP-DB] dynamic URL result in search?

2002-06-05 Thread Ruprecht Helms


Hi Rita,

[...] I need to get users to the page their
 book is on [books.php?page=3] -- else they'll have to try to find the book
 they searched for by going through a bunch of pages.

verbal

if found
books.php?page=$booksite
else
URL searchsite
endif


You mast have a databaseconnection an an SELECT-Statement
with WHERE-Clause to select the wanted book(s).

Regards,
Ruprecht

--
E-Mail: Ruprecht Helms [EMAIL PROTECTED]
Date: 05-Jun-02
Time: 09:12:23

to be informed - http://www.rheyn.de -

This message was sent by XFMail
--

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




[PHP-DB] values across functions

2002-06-05 Thread James Kupernik

I have a file, it's a shopping cart. Currently is contains all the fuctions
required in the cart, including the shipping and billing form. It won't take
the values from the shipping form and use them in the functions that
calculate the tax and S  H. Why would this be? I've gotten other variables
to transfer, just not these.

Thanks



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




[PHP-DB] PHP amd MYSQL

2002-06-05 Thread Peter Goggin

I am setting up a web page system which involves html pages, php pages and
mysqldatabase.

I have a number of questions and do not know where to find answers.

If  I display the rows from a database table in a php generated html table
is it possible to mark a row so that it can be deleted or modified by
calling another php page? If so is this documented anywhere?

Is there any good source of information on setting up 'forms'to work like
Oracle forms where database records can be inserted, updated or deleted?


Regards


Peter Goggin




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




[PHP-DB] Relations n-m

2002-06-05 Thread Antonio Bernabei

Hi to everyone,
I have a database with three tables
books, authors and booksauthors.
Books has the fields idbook, title and thers
Authors has the fields idauthor,name and others
booksauthors has two fields idauthor and idbook
Every book can have up to 3 authors and in the booksauthors table there is a
row for every author of the book. If book 3 has authors 4,5 and 7 I have
three rows (3,5) (3,4) and (3,7)
Can anyone tell me what is in mysql the query to get on a single line
book,author1,author2, author3?
Thanks to everyone

Antonio Bernabei


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




Re: [PHP-DB] Trouble displaying info in a multiline form

2002-06-05 Thread Paulo Nunes

Thanks for help. It worked fine.
But now i have another problem ( i'm new in php/html) : the textarea doesn't
have the size that i need. I need a bigger textarea.How should i do this?

Thanks again
Paulo



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




Re: [PHP-DB] Trouble displaying info in a multiline form

2002-06-05 Thread Tony

Text area is controled by col and row size.
If it's not big enough (doesn't look big enough), just make the col or row
size bigger.

Tony S. Wu
[EMAIL PROTECTED]


 Thanks for help. It worked fine.
 But now i have another problem ( i'm new in php/html) : the textarea doesn't
 have the size that i need. I need a bigger textarea.How should i do this?
 
 Thanks again
 Paulo
 
 





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




Fwd: [PHP-DB] PHP amd MYSQL

2002-06-05 Thread Terry Romine


 I'll add this snippet in to prevent accidental deletes:

 a href=delete.php?id=' . $row[id] . ' onClick='return confirm(\Do 
 you really want to delete this record?\)' ' . $row[name] . '/a

 On Wednesday, June 5, 2002, at 09:20  AM, 
 [EMAIL PROTECTED] wrote:

 One way to do it would be thusly:

 $result=mysql_query(yadayada);
 foreach($result as $row){
 echo '
 trtd
 a href=delete.php?id=' . $row[id] . '' . $row[name] . '/a
 ...
 /tr';
 }

 This would set up a url that when the user clicks on $row[name] (such 
 as
 Record Description it would call delete.php with the argument of 
 $row[id]

 Within that delete.php, you remove the selected record, then call the
 original page.

 Use:
 $sql=DELETE from table where id=$id;

 Then do:
 echo '
 Header(Location: original_location.php);

 You can't have any html previous to the Header command, though.

 This will return you to your original page where you can do your select
 again, and the deleted row won't show up.

 You may need to pass parameters on the Header line to let
 original_location.php exactly where you were previously. This would 
 have to
 be passed either on the url or as a post/get operation when first 
 calling
 delete.php

 Terry Romine
 Web Developer
 JumpInteractive.com



Re: [PHP-DB] permissions system

2002-06-05 Thread Kevin Stone

Very simply I protect whole pages on my member's website by include()'ing a
script called auth.php into the top of each page.  Rather than using a
binary string to turn functions 'on' and 'off', I do things a bit more
general than that.  I have defined levels of access (ie, L1, L2, L3, etc..)
stored in the member's table in the database.  At the top of each page I
wish to protect I write ($min_access = 'L2') to define a minimum level of
access.  If the user has L2 access or greater they'll fall right through the
auth.php and end up on the page.  Otherwise one of the conditionals will
catch them like a net and dump them into the logout() function which kills
the session and displays the login screen with a lovely ACCESS DENIED (or
other appropriate text) message.  In this way I can protect any number and
type of webpage (so long as I rename it .php) without registering the
filename.  And all of my staff and admin scripts can remain public instead
of behind some .htaccess file.

As for the complexity of auth.php.  It's hardly complex but I'm fairly
thurough in my check.  The auth.php script is actually about 150 lines of
code and does timeout, tracks the member's movement and more...  but it
could be as simple as a single db query.  This is the best continuous
pervasive authentication scheme I have devised.  It's probably not as good
as other systems out there but it does the job in the limited scope of
protecting my member's site.  :)

-Keivn

- Original Message -
From: Jason Markantes [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, June 04, 2002 10:43 PM
Subject: [PHP-DB] permissions system


 Howdy All-

 I've poked around the net for some snippets, and have done my own in the
past,
 but wanted to get some more ideas on how you do a permissions system.
This
 means, in your application, how do you control and enforce different
 permissions for different users?

 Simple example: An image repository. You have users who can download
images
 and/or upload images. And certain users can only search for images within
a
 certain criteria.

 What I've done in the past is created a permission_flag column for each
user.
 Zero or One determines whether or not the user can do that function, and
the
 various functions are indicated by position (or index). So if you had
upload
 and download functions, you can have:

 01 = can download, but can't upload
 11 = can download and upload.

 If I add a new function, I have to add another digit (and potentially
increase
 the column size if things grow faster than planned).

 To enforce this, as a user attempts each function, I simply check the
function
 index and see if it's one or zero.

 With me so far?

 Now, for restricting database access:

 What I've done is created a user_where column for each user. In this
column I
 add a where clause that's appended to each and every search the user
attempts
 (with the usual input safety checks for common db exploits).

 For example, if a user can only see Approved images (in my pretend
application
 example here), the user_where value might be category = 'Approved'. For
 multiple values, it could be category IN ('Approved', 'Pending').

 Does this make sense? How are other people doing things? I've given a
little
 bit of thought to it, but not enough. With all the applications out there
 everyone at some point has to come up with their own system.

 Ideas?

 Thanks,
 Jason



 =
 Just Another Fu@#in' Adventure
 http://markantes.com/jason

 __
 Do You Yahoo!?
 Yahoo! - Official partner of 2002 FIFA World Cup
 http://fifaworldcup.yahoo.com

 --
 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] PHP amd MYSQL

2002-06-05 Thread Miguel Carvalho

Hi,

 I am setting up a web page system which involves html pages, php pages
 and mysqldatabase.

 I have a number of questions and do not know where to find answers.

 If  I display the rows from a database table in a php generated html
 table is it possible to mark a row so that it can be deleted or
 modified by calling another php page?

I dont know if mysql supports select for update, but the locking will not
work. The reasons are:
   As soon the PHP page ends, PHP will realease all non persistent
   database connections.You can work around this, using a persistent connection( this 
type of
connection doesnt close even after the php script ends ), but this kind of
connection can bring you troubles. You will get troubles if you run insert
or update commands, because all script instances will share the same
database connection. If for some reason, a script( or the db server )
locks the table for some reason, all scripts that use the persistent connection
  will wait for the unlock of the table.Worse, if you rollback a transaction, every 
transactions that use the
persistent connection will be roolbacked.

Is there any reason to lock the rows?

If so is this documented
 anywhere?


 Is there any good source of information on setting up 'forms'to work
 like Oracle forms where database records can be inserted, updated or
 deleted?

I dont know. Sorry.

Regards
Miguel



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




Re: [PHP-DB] Trouble displaying info in a multiline form

2002-06-05 Thread Martin Clifford

TEXTAREA rows=x cols=y wrap=virtual

Example text to be inside box on load.

/TEXTAREA

x = height, using monospace font for measurement.  Usually 5 suffices.
y = width, using monospace font for measurement.  Usually 40 suffices.

Martin

 Paulo Nunes [EMAIL PROTECTED] 06/05/02 02:00PM 
Thanks for help. It worked fine.
But now i have another problem ( i'm new in php/html) : the textarea doesn't
have the size that i need. I need a bigger textarea.How should i do this?

Thanks again
Paulo



-- 
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-DB] not a problem per se, just a curiosity.

2002-06-05 Thread Jeffrey_N_Dyke

I have have developed a statistics package that tracks user info(browser,
os, colors, heights, widths etc) as well as where and when they use my
various sites.

in the tables there are about 40 hits of aproximately 7,000 that the
broswer entry is PHP/2.0 and PHP/1.2 only.
Normally an entry looks like - Mozilla/5.0 (Windows; U; WinNT4.0; en-US;
rv:0.9.4) Gecko/20011128 Netscape6/6.2.1, but these are just PHP/2.0 for
example

The IP address it inserts is the address of the server itself.  It does not
look to be a misreprensted browser as it never accepts a cookie showing
itself as a return visitor(internal site, all our browsers accept cookies)

Anyone have any idea to how this info gets in there.  It has hit different
pages, and is not a daily entry or anything that would lend itself to a
hint.

as i said in the subject - not a problem per se, just a curiosity.

Be well all,
Jd

ps.  I have this same package on external www sites, and this entry never
shows.


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




[PHP-DB] Slow performance (PHP MYSQL)

2002-06-05 Thread Radek Zajkowski

I am making pages for a client signed up with verio under signature 
hosting. 

The pages are very simple request from db for thumbnails, which are 
displayed 4 at a time etc.

could it be because I'm generating the entire pages via PHP eg. 

echo(html)
echo(head)
echo(titleI'm so slow/title)
echo(/head) etc. etc.

as oppose to embedding the php into the html

R

Thanks in advance.

--__-__-__
eat pasta
type fasta


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




RE: [PHP-DB] values across functions

2002-06-05 Thread Beau Lebens

have you declared the variables as global int eh function?

eg

function foo($bar) {
global $this, $that, $theOther;

[...]
}

that way $this, $that and $theOther variables are available everywhere

HTH

Beau

// -Original Message-
// From: James Kupernik [mailto:[EMAIL PROTECTED]]
// Sent: Wednesday, 5 June 2002 9:35 PM
// To: [EMAIL PROTECTED]
// Subject: [PHP-DB] values across functions
// 
// 
// I have a file, it's a shopping cart. Currently is contains 
// all the fuctions
// required in the cart, including the shipping and billing 
// form. It won't take
// the values from the shipping form and use them in the functions that
// calculate the tax and S  H. Why would this be? I've gotten 
// other variables
// to transfer, just not these.
// 
// Thanks
// 
// 
// 
// -- 
// 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-DB] Re: mysql_fetch_array pointer

2002-06-05 Thread Jason Morehouse

mysql_data_seek($result_cat,0);

http://www.php.net/manual/en/function.mysql-data-seek.php

On Tue, 29 Aug 2000 22:55:11 +1200, Jeffrey Barendse wrote:

 I like to use a script like this:
 
 
 $result_cat = mysql_query(select cat_naam from categorie order by
 cat_naam);
 
  while($row = mysql_fetch_array($result_cat))
 {  echo 'OPTION VALUE=' . (urlencode($row[cat_naam])) . '' .
 $row[cat_naam]; }
 
  while($row = mysql_fetch_array($result_cat))
 {  echo $row[cat_naam]; }
 
 
 In the first while function it works fine. But in the other I have no
 date. I suppose the mysql_fetch_array sets a pointer. Is there a way to
 reset the pointer so I can reuse a query?
 
 Regards,
 
 Jeffrey Barendse
 WireITup
 

-- 
 Jason Morehouse ([EMAIL PROTECTED])
 Netconcepts LTD - Auckland, New Zealand
 * Linux: Because rebooting is for adding hardware.

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




[PHP-DB] date problem

2002-06-05 Thread andy

Hi there,

I would like to count the users out of a mysql db who registered after a
certain date.

The column I have in the db is a char and I do not want to change this
anymore.
This is how a typical entry looks like: May 29, 2002

This is how I tryed it:

// while '10...' is unix timestamp june 1, 02
SELECT COUNT(*) AS c
FROM users_table
WHERE UNIX_TIMESTAMP( user_regdate )  '1022882400'

Thanx for any help on that,

andy





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




[PHP-DB] date problem

2002-06-05 Thread andy

Hi there,

I would like to count the users out of a mysql db who registered after a
certain date.

The column I have in the db is a char and I do not want to change this
anymore.
This is how a typical entry looks like: May 29, 2002

This is how I tryed it:

// while '10...' is unix timestamp june 1, 02
SELECT COUNT(*) AS c
FROM users_table
WHERE UNIX_TIMESTAMP( user_regdate )  '1022882400'

Thanx for any help on that,

andy




query







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




[PHP-DB] Re: [PHP] date problem

2002-06-05 Thread Miguel Cruz

On Thu, 6 Jun 2002, andy wrote:
 I would like to count the users out of a mysql db who registered after a
 certain date.
 
 The column I have in the db is a char and I do not want to change this
 anymore.
 This is how a typical entry looks like: May 29, 2002
 
 This is how I tryed it:
 
 // while '10...' is unix timestamp june 1, 02
 SELECT COUNT(*) AS c
 FROM users_table
 WHERE UNIX_TIMESTAMP( user_regdate )  '1022882400'

You can only call UNIX_TIMESTAMP on a DATE or DATETIME field, not on just
any generic CHAR/VARCHAR/TEXT/whatever. May 29, 2002 isn't a MySQL
timestamp, so I'm guessing you have a textual field type.

The lesson of all this is: Convert dates to either unix or database-native 
date format before storing them in the database. Things like May 29, 
2002 are useless in a database.

At this point I'd recommend running a quick script to strtotime() all your
dates and then re-write them to a new field that's in a proper format.

miguel


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