Re: SV: [PHP-DB] Straightforward authentication?

2001-09-17 Thread Russ Michell

Thanks for the password/info, however I have one further (possibly bumb) question, is 
there a 
commonly employed method of securing one's database to prevent hacker's peering in and 
viewing 
plain-text/hashed passwords?

I use MySQL 3.22.32 with php4.0.3
Cheers.

Russ

On Thu, 13 Sep 2001 19:28:18 +0200 Torgil Zechel [EMAIL PROTECTED] wrote:

 A common way to identify a client is to use the challange-response
 algorithm. It works like this:
 
 Ps is the password stored on the server
 Pc is the password entered by the client
 H is a hash-function (md5 for example)
 V is a 'random' value
 
 Server calculates H(V + Ps) and save this in a session variable. The server
 then send V to the client which respond with H(V + Pc). Now, the server can
 compare H(V + Ps) with H(V + Pc). If they are equal, the user must have
 given the correct password! Otherwise the identification failed.
 
 The good thing with this algorithm is that no password need to be sent in
 plain-text between the client and the server. The random value is used to
 ensure that the response is not just something that a hacker has sniffed in
 a previous session. The downside is that the database must be secure, since
 the passwords are stored in plain-text.
 
 A even better way is of course to use SSL. In that case the client just send
 the password to the server and the server compares H(P) with the stored hash
 in the database.
 
 Don't know if this was what you were looking for...
 
 /torgil
 
  -Ursprungligt meddelande-
  Fran: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]For Russ Michell
  Skickat: den 13 september 2001 17:36
  Till: [EMAIL PROTECTED]
  Amne: [PHP-DB] Straightforward authentication?
 
 
  Hi all:
 
  The few php/MySQL apps I've developed that required
  username/password access, have simply been a
  means of comparing usernames and hashes of passwords in a DB. My
  next application needs to be
  slightly more secure but nothing like the needs of protecting
  online banking or vulnerable private
  info.
 
  I have read several articles at phpbuilder.com and stuff at
  php.net, and frankly most of it seems
  to be overly contrived.
 
  I wonder wether some list members would be able to point me in
  the direction of code and/or
  tutorials that *explain* in English what they're doing and why.
  For example why they are storing an
  MD5() hash of something in a seperate file outside the
  web-server's doc-root etc etc.
 
  Once I have my head round the concepts I'll be posting my
  findings to a public location which
  list-members will be among the first to view.
 
  I thank y'all for any help you are able to give.
  Cheers
 
  Russ
 
  #---#
 
Believe nothing - consider everything
 
Russ Michell
Anglia Polytechnic University Webteam
Room 1C 'The Eastings' East Road, Cambridge
 
e: [EMAIL PROTECTED]
w: www.apu.ac.uk/webteam
t: +44 (0)1223 363271 x 2331
 
www.theruss.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]
 

#---#

  Believe nothing - consider everything   
  
  Russ Michell
  Anglia Polytechnic University Webteam
  Room 1C 'The Eastings' East Road, Cambridge
  
  e: [EMAIL PROTECTED]
  w: www.apu.ac.uk/webteam
  t: +44 (0)1223 363271 x 2331

  www.theruss.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-DB] Re: NEWBIE - Needs Assistance with Joins

2001-09-17 Thread Michael Egan

Cecily,

I think yuo need to specify the fields within the tables when you write
out a select query from multiple tables like this.

For example:

SELECT artist_name.*, album_title.* .
FROM artists, album_titles WHERE artist_name.artist_id = aid);
 
Hope this works,


Michael 


Cecily Walker Kidd wrote:
 
 Hello,
 
 I have two tables, one that contains an item id, album title name, and
 artist ID number. The second table is a list of artists, with an
 auto-increment artist ID.
 
 I want to join the two tables and have them output to a single PHP page.
 I was following along with the tutorial at
 http://www.webmasterbase.com/article/228/, and tried to modify it for my
 own needs.  When I do this, I get a parse error on the line that starts
 with SELECT.  Here's the code:
 
 $Link = mysql_connect ($Host, $User, $Password);
 
 $CDList =mysql_query(
 SELECT artist_name, album_title .
 FROM artists, album_titles WHERE artist_id = aid);
 
 
 What am I doing wrong?
 
 Thanks in advance.

-- 
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] Re: NEWBIE - Needs Assistance with Joins

2001-09-17 Thread Rick Emery

SELECT artist_name, album_title FROM album_titles LEFT JOIN artist
USING(aid) WHERE artist_id = aid

-Original Message-
From: Michael Egan [mailto:[EMAIL PROTECTED]]
Sent: Monday, September 17, 2001 8:22 AM
To: [EMAIL PROTECTED]; Cecily Walker Kidd
Subject: [PHP-DB] Re: NEWBIE - Needs Assistance with Joins


Cecily,

I think yuo need to specify the fields within the tables when you write
out a select query from multiple tables like this.

For example:

SELECT artist_name.*, album_title.* .
FROM artists, album_titles WHERE artist_name.artist_id = aid);
 
Hope this works,


Michael 


Cecily Walker Kidd wrote:
 
 Hello,
 
 I have two tables, one that contains an item id, album title name, and
 artist ID number. The second table is a list of artists, with an
 auto-increment artist ID.
 
 I want to join the two tables and have them output to a single PHP page.
 I was following along with the tutorial at
 http://www.webmasterbase.com/article/228/, and tried to modify it for my
 own needs.  When I do this, I get a parse error on the line that starts
 with SELECT.  Here's the code:
 
 $Link = mysql_connect ($Host, $User, $Password);
 
 $CDList =mysql_query(
 SELECT artist_name, album_title .
 FROM artists, album_titles WHERE artist_id = aid);
 
 
 What am I doing wrong?
 
 Thanks in advance.

-- 
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] Quotes, double-quotes, and the like.

2001-09-17 Thread Rick Emery

If the essays will be long, I'd suggest storing them in separate files and
storing the file name for each essay in the MySQL database.

-Original Message-
From: Ari M. Roth [mailto:[EMAIL PROTECTED]]
Sent: Sunday, September 16, 2001 3:15 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Quotes, double-quotes, and the like.


I'm trying to create a web-based interface that will allow me to save
essays to a mySQL database for display on a website.  The problem is
that it may include HTML in it, so I need to preserve double-quotes in
their original context.  Right now, they are not encoding correctly for
some reason.  An HTML link, for example, to http://www.yahoo.com would
come out as this:

http://localhost/http://www.yahoo.com;

addslashes() accomplished nothing, and I'm at a loss.  Any ideas?

Thanks.

Later...

-Ari

-- 
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] Quotes, double-quotes, and the like.

2001-09-17 Thread Justin Buist

On Sun, 16 Sep 2001, Ari M. Roth wrote:

 I'm trying to create a web-based interface that will allow me to save
 essays to a mySQL database for display on a website.  The problem is
 that it may include HTML in it, so I need to preserve double-quotes in
 their original context.  Right now, they are not encoding correctly for
 some reason.  An HTML link, for example, to http://www.yahoo.com would
 come out as this:

 http://localhost/http://www.yahoo.com;

 addslashes() accomplished nothing, and I'm at a loss.  Any ideas?

You should probably paste the HTML form and perhaps the PHP code which
does the actual insersts -- it's completely illogical that
http://localhost/; would magically appear before a field name.  At least
in my book.

Justin Buist
Trident Technology, Inc.
4700 60th St. SW, Suite 102
Grand Rapids, MI  49512
Ph. 616.554.2700
Fx. 616.554.3331
Mo. 616.291.2612


-- 
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] mail ()

2001-09-17 Thread Sam Masiello


I think you might want to be a little more specific as to what you are
trying to accomplish.  Give us some more details and we would be glad to
help you out!

HTH

Sam Masiello
Software Quality Assurance Engineer
Synacor 
(716) 853-1362 X289
[EMAIL PROTECTED]


-Original Message-
From: Andrius Jakutis [mailto:[EMAIL PROTECTED]] 
Sent: Monday, September 17, 2001 1:43 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] mail ()

Hello,

How to make field required?

Using mail ()


Thanks.





-- 
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] Stupid question=p

2001-09-17 Thread Sam Masiello


You can't store the array as an array, but what you can do is serialize
the array to create a string, then store THAT in the database.  

For example:

$myarray = your array of stuff; 
$myserializedarray = serialize($myarray) ;

$myserialized array is now a string that you can store in the database.
When you pull it out of the database, you can use the unserialize()
function to turn it back into an array.

See http://www.php.net/serialize for more information.

HTH

Sam Masiello
Software Quality Assurance Engineer
Synacor 
(716) 853-1362 X289
[EMAIL PROTECTED]


-Original Message-
From: Glenn B. [mailto:[EMAIL PROTECTED]] 
Sent: Sunday, September 16, 2001 3:44 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Stupid question=p

Am I able to make a field an array in MySQL?  Thanks.



-- 
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] Porting from MySQL to DB2

2001-09-17 Thread Miles Thompson

Not that I know of, but mysqldump generates a script to regenerate and 
relaod the database. Chekc your docs.
You could take this and amend it to generate your DB2 database, possibly 
re-populate it too.

For the scripts themselves, there are probably some awk wizards out there 
that can do it in 6 lines of code. g

Miles

At 04:01 PM 9/17/01 +, Guðmundur Ö. Ingvarsson wrote:
Does anyone have PHP or CGI/Perl scripts to do this easily?


Kveðja / Regards

==
Guðmundur Örn Ingvarsson
Chief technician of daily operations /
Rekstrarstjóri á rekstrarborði
Íslandssími hf
Web Site - http://www.islandssimi.is
E-Mail - [EMAIL PROTECTED]
Buisness phone - +354 595 5000
==


--
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] Cookies ???

2001-09-17 Thread Jason Caldwell

I've been reading the threads under SETCOOKIE (from php.net) -- some people
are saying that setcookie doesn't seem to work for all browsers all of the
time.  Then some others go into how it seems to actually be the TIME format
(unix time vs. GMT time) --

Should I just stick to the HEADER version instead of setcookie?

Also -- I'm not completely clear on how cookies work in the first place...

Q1: When I set a cookie, is that cookie automatically called from *each*
page on my website?  Or, do I need to add the HEADER to each page where I
want to call the cookie?

Q2: The 'Cookie Path' -- is this the PATH on my websever -- someone please
explain what this is exactly, and how it works.

Q3: The scenario I would like to use cookies in is to have users
automatically be logged in when they come to my home page... so I will need
to store the Username and Password in the cookie... should I store these in
an Array, or can I create multiple cookies -- in other words, a cookie can
only store one value, correct?  So, I can use Serialize / Unserialize to
store Array information in my cookies?

Thanks.
Jason




-- 
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] Re: NEWBIE - Needs Assistance with Joins

2001-09-17 Thread Vera Algoet

Cecily,
I'm sure you probably heard from others about your parse error. I know 
it looks weird, but you need to have two semicolons, so instead of:

 $CDList =mysql_query(
 SELECT artist_name, album_title .
 FROM artists, album_titles WHERE artist_id = aid);

you would have
$CDList =mysql_query(
SELECT artist_name, album_title .
FROM artists, album_titles WHERE artist_id = aid;);

(Note the semicolon after aid). This is because the first one is to 
complete the SQL statement, while the one after the parenthisis is to 
complete the PHP statement.

Vera
---
Madness takes its toll. Please have exact change.

Vera Algoet, Web Developer
Monterey County Office of Education
831-784-4169



Re: [PHP-DB] Cookies ???

2001-09-17 Thread Justin Buist

On Mon, 17 Sep 2001, Jason Caldwell wrote:

 I've been reading the threads under SETCOOKIE (from php.net) -- some people
 are saying that setcookie doesn't seem to work for all browsers all of the
 time.  Then some others go into how it seems to actually be the TIME format
 (unix time vs. GMT time) --

 Should I just stick to the HEADER version instead of setcookie?

Take a look at the comment dates; the earliest ones date back to 1998,
which IIRC was around version 3.0.12 of PHP if not earlier.  Given PHPs
open source nature I'd imagine any wrong-doings of setcookie() have been
fixed but perhaps a PHP deveoper would be better able to comment on this.
I'd try it with setcookie() first, test it out with your target browsers
and only change to header() if needed.

 Also -- I'm not completely clear on how cookies work in the first place...

 Q1: When I set a cookie, is that cookie automatically called from *each*
 page on my website?  Or, do I need to add the HEADER to each page where I
 want to call the cookie?

Yes, the browser will shove back all cookies if they're viewable by that
script.  That's just how HTTP works, it shoves a request over with all
supporting data, awaits the request and kills the connection(^*).


 Q2: The 'Cookie Path' -- is this the PATH on my websever -- someone please
 explain what this is exactly, and how it works.

Yep, path on the webserver.  If you set a cookie with domain
www.yourdomain.com and path /scripts only request to
www.yourdomain..com/scripts and below will see it.

 Q3: The scenario I would like to use cookies in is to have users
 automatically be logged in when they come to my home page... so I will need
 to store the Username and Password in the cookie... should I store these in
 an Array, or can I create multiple cookies -- in other words, a cookie can
 only store one value, correct?  So, I can use Serialize / Unserialize to
 store Array information in my cookies?

Using serialize/unserialize isn't a bad idea, but neither is setting two
cookies in my opinion.  I'd say take your pick, choose whatever's most
comfortable for you.  I'd recommend only looking at the username/password
cookies if a PHP session hasn't been established though to save you from
takeing a quick query to your DB for every hit on each page though.

I'll skip the security mumbo-jumbo for now on passing stuff around in
plaintext because I'm not sure if that's really of any concern for your
project.  If it is, and you're clueless as to what I'm talking about, let
me know and I'll try and elaborte a bit more.

[*]  HTTP -used- to kill the connection after every request but now
sessions can be held open to save overhead.  The ramifications of this
change in design have absolutely no effect on application design though
because it's not guaranteed behavior.

Justin Buist
Trident Technology, Inc.
4700 60th St. SW, Suite 102
Grand Rapids, MI  49512
Ph. 616.554.2700
Fx. 616.554.3331
Mo. 616.291.2612


-- 
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 ???

2001-09-17 Thread Rick Emery

Q1.  If you simply wish to READ the cookie from each web page, you need do
nothing.  It is created atuomatically as a variable for you.  For instance,
a cookie named
mycookie is available as $mycookie.

Q2.  The Cookie Path is the reference point on the web server.  I creates a
context for the cookie.  It allows the cookie to be read when a web page
comes from that specific directory.  If you want it to be available from all
directories, use /.

Q3.  The cookie can store multiple values that you concatenate together.
For instance, to store username/password:
setcookie( cookiename, $user#$password, time()+3600, /,
.mydomain.com );
Then, upon reading the cookie: list($user,$password) = explode( #,
$cookiename );


FYI...setcookie() has worked for me on IE 5.x and NN 5.x.

-Original Message-
From: Jason Caldwell [mailto:[EMAIL PROTECTED]]
Sent: Monday, September 17, 2001 11:35 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Cookies ???


I've been reading the threads under SETCOOKIE (from php.net) -- some people
are saying that setcookie doesn't seem to work for all browsers all of the
time.  Then some others go into how it seems to actually be the TIME format
(unix time vs. GMT time) --

Should I just stick to the HEADER version instead of setcookie?

Also -- I'm not completely clear on how cookies work in the first place...

Q1: When I set a cookie, is that cookie automatically called from *each*
page on my website?  Or, do I need to add the HEADER to each page where I
want to call the cookie?

Q2: The 'Cookie Path' -- is this the PATH on my websever -- someone please
explain what this is exactly, and how it works.

Q3: The scenario I would like to use cookies in is to have users
automatically be logged in when they come to my home page... so I will need
to store the Username and Password in the cookie... should I store these in
an Array, or can I create multiple cookies -- in other words, a cookie can
only store one value, correct?  So, I can use Serialize / Unserialize to
store Array information in my cookies?

Thanks.
Jason




-- 
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] Re: NEWBIE - Needs Assistance with Joins

2001-09-17 Thread biorn

You should not need the extra semicolon in there to complete the SQL
statement.  All you need is the one at the end.

  

Vera Algoet [EMAIL PROTECTED] said:

 Cecily,
 I'm sure you probably heard from others about your parse error. I know 
 it looks weird, but you need to have two semicolons, so instead of:
 
  $CDList =mysql_query(
  SELECT artist_name, album_title .
  FROM artists, album_titles WHERE artist_id = aid);
 
 you would have
 $CDList =mysql_query(
 SELECT artist_name, album_title .
 FROM artists, album_titles WHERE artist_id = aid;);
 
 (Note the semicolon after aid). This is because the first one is to 
 complete the SQL statement, while the one after the parenthisis is to 
 complete the PHP statement.
 
 Vera
 ---
 Madness takes its toll. Please have exact change.
 
 Vera Algoet, Web Developer
 Monterey County Office of Education
 831-784-4169
 



-- 




-- 
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] possible mysql_insert_id() conflicts ?

2001-09-17 Thread rene kretzschmar

hi,

Imagine the following php+mysql scenario:

there are two tables:
create table testuser(id int not null auto_increment, name varchar(255),
primary key(id));
create table testaddress(id int not null auto_increment, user int not
null,street varchar(255), primary key(id));

the *.php test script contains the following lines:
mysql_query(insert into testuser (name) ('testname'));
//--* (see below)
$userid = mysql_insert_id();
mysql_query(insert into testaddress(user,street)
values('$userid','teststreet'));

* at this time another thread could insert another record into testuser

and the logical question: Will I get the right $userid from
mysql_insert_id() anyway ??

thanx - rené





-- 
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] Re: NEWBIE - Needs Assistance with Joins

2001-09-17 Thread Sheridan Saint-Michel

No, the only time you need a semicolon within the query string is if you are
performing
multiple commands.

ie $query=Set @count=0; Select name,@count=@count+1 as count from people;

Sheridan Saint-Michel
Website Administrator
FoxJet, an ITW Company
www.foxjet.com


- Original Message -
From: Vera Algoet [EMAIL PROTECTED]
To: [EMAIL PROTECTED]; Cecily Walker Kidd [EMAIL PROTECTED]
Sent: Monday, September 17, 2001 12:10 PM
Subject: [PHP-DB] Re: NEWBIE - Needs Assistance with Joins


 Cecily,
 I'm sure you probably heard from others about your parse error. I know
 it looks weird, but you need to have two semicolons, so instead of:

  $CDList =mysql_query(
  SELECT artist_name, album_title .
  FROM artists, album_titles WHERE artist_id = aid);

 you would have
 $CDList =mysql_query(
 SELECT artist_name, album_title .
 FROM artists, album_titles WHERE artist_id = aid;);

 (Note the semicolon after aid). This is because the first one is to
 complete the SQL statement, while the one after the parenthisis is to
 complete the PHP statement.

 Vera
 ---
 Madness takes its toll. Please have exact change.

 Vera Algoet, Web Developer
 Monterey County Office of Education
 831-784-4169



-- 
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] Re: NEWBIE - Needs Assistance with Joins

2001-09-17 Thread Jonathan Hilgeman

You said you get a parse error - so I'm assuming that is a PHP parse error,
not an SQL error. Can you attach the entire problem file to an e-mail and
send it to me, along with the exact error message? I have a feeling that it
is something to do with the way you are retrieving the results in your PHP
code...

- Jonathan

Cecily Walker Kidd [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]...
 Hello,

 I have two tables, one that contains an item id, album title name, and
 artist ID number. The second table is a list of artists, with an
 auto-increment artist ID.

 I want to join the two tables and have them output to a single PHP page.
 I was following along with the tutorial at
 http://www.webmasterbase.com/article/228/, and tried to modify it for my
 own needs.  When I do this, I get a parse error on the line that starts
 with SELECT.  Here's the code:

 $Link = mysql_connect ($Host, $User, $Password);

 $CDList =mysql_query(
 SELECT artist_name, album_title .
 FROM artists, album_titles WHERE artist_id = aid);


 What am I doing wrong?

 Thanks in advance.



-- 
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] Re: NEED HELP WITH ORACLE PHP PLZ.

2001-09-17 Thread Jason Holmberg

Brian,

How did you configure PHP (ie what was your ./configure string?).  I am
having trouble even getting PHP set up to where it even recognizes the
Oracle functions.  When I try to execute a script similar to what you have
written all I get is 'function undefined.'

Thanks,
Jason

On 9/13/01 12:16 PM, in article [EMAIL PROTECTED],
Brian Ofsthus [EMAIL PROTECTED] wrote:

 I have The following
 
 A Sun Ultra2 Running the Oracle Client talking to a Oracle Instance 8.1.7 on
 another server.
 
 sqlplus  scott@rhinodb  works greate. I do have to be in $ORACLE_HOME for
 some reason.
 
 When I issue the following command I get an error
 
 !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.0 Transitional//EN
 
 html
 head
 titleUntitled/title
 /head
 
 body
 ?php
 $link = ora_logon(scott@RHINODB, tiger)
   or die (Could not connect);
   print (YAA  Connected successfully);
 ?
 
 
 /body
 /html
 
 
 Error in the Browser
 
 Warning: Oracle: Connection Failed: Error while trying to retrieve text for
 error ORA-12154 in /export/dsk2/apache/htdocs/rhinodb/cgi-bin/dbtest.php on
 line 8
 YAA Connected successfully
 
 
 


-- 
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] possible mysql_insert_id() conflicts ?

2001-09-17 Thread Justin Buist

From: http://www.php.net/manual/en/function.mysql-insert-id.php

xochotorena AT arista IN Spain
06-Aug-2001 03:02
From mysql's manual:

The last ID that was generated is maintained in the server on a
per-connection
basis. It will not be changed by another client. It will not even be
changed if
you update another AUTO_INCREMENT column with a non-magic value (that is,
a value that is not NULL and not 0).

As each thread is using it's own connection there is no need to lock the
table.


... that should answer your question.  No need to worry, just trust that
MySQL will handle it for you.

Justin Buist
Trident Technology, Inc.
4700 60th St. SW, Suite 102
Grand Rapids, MI  49512
Ph. 616.554.2700
Fx. 616.554.3331
Mo. 616.291.2612

On Mon, 17 Sep 2001, rene kretzschmar wrote:

 hi,

 Imagine the following php+mysql scenario:

 there are two tables:
 create table testuser(id int not null auto_increment, name varchar(255),
 primary key(id));
 create table testaddress(id int not null auto_increment, user int not
 null,street varchar(255), primary key(id));

 the *.php test script contains the following lines:
 mysql_query(insert into testuser (name) ('testname'));
 //--* (see below)
 $userid = mysql_insert_id();
 mysql_query(insert into testaddress(user,street)
 values('$userid','teststreet'));

 * at this time another thread could insert another record into testuser

 and the logical question: Will I get the right $userid from
 mysql_insert_id() anyway ??

 thanx - rené





 --
 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] Application-based locking with PHP?

2001-09-17 Thread Barry L. Jeung

Just wondering if anyone has tried doing quasi application based locking
with PHP? My scenario is this. I'm constructing a database for my
company to help keep track of trouble tickets, etc with a web-based
frontend. I'm using PHP (obviously =]) for inputing/retrieving data and
have a slight predicament. Since MySQL does table-level locking, if I
put lock statements in my queries, it would cause two problems. One
being the entire table being locked and two if the user just closes the
webpage without exiting properly, the table would remain locked
indefinately. So I'm trying to think of alternatives, one of which is
using global variables to store table/record id's, and then evaluating
the queries based on that information. So if John selects ticket # 5 and
might be updating it, then when Bob attempts to select ticket #5, then
the $id and $table variables would be checked against the variables
stored when john placed his query, and bob would get a message saying
that record #5 is locked or in-use by John and to try later. Is this
feasible or is there a better way to do this? Thanks for your time.


--
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] Application-based locking with PHP?

2001-09-17 Thread Matthew Loff


PostgreSQL does row-level locking... But I'm more familiar with MySQL,
as I presume you are...

If you want to rely on MySQL's table locking, but are worried about a
user aborting the script, see:

http://www.php.net/manual/en/ref.misc.php

A combination of ignore_user_abort() and connection_aborted() will allow
you to determine if the user has aborted, and unlock the table
accordingly.



-Original Message-
From: Barry L. Jeung [mailto:[EMAIL PROTECTED]] 
Sent: Monday, September 17, 2001 3:00 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Application-based locking with PHP?


Just wondering if anyone has tried doing quasi application based locking
with PHP? My scenario is this. I'm constructing a database for my
company to help keep track of trouble tickets, etc with a web-based
frontend. I'm using PHP (obviously =]) for inputing/retrieving data and
have a slight predicament. Since MySQL does table-level locking, if I
put lock statements in my queries, it would cause two problems. One
being the entire table being locked and two if the user just closes the
webpage without exiting properly, the table would remain locked
indefinately. So I'm trying to think of alternatives, one of which is
using global variables to store table/record id's, and then evaluating
the queries based on that information. So if John selects ticket # 5 and
might be updating it, then when Bob attempts to select ticket #5, then
the $id and $table variables would be checked against the variables
stored when john placed his query, and bob would get a message saying
that record #5 is locked or in-use by John and to try later. Is this
feasible or is there a better way to do this? Thanks for your time.


-- 
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] Re: NEWBIE - Needs Assistance with Joins

2001-09-17 Thread Matthew Loff


There should -not- be a semicolon at the end of the SQL query when using
mysql_query() through PHP... 

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

The problem lies elsewhere.


-Original Message-
From: Vera Algoet [mailto:[EMAIL PROTECTED]] 
Sent: Monday, September 17, 2001 1:11 PM
To: [EMAIL PROTECTED]; Cecily Walker Kidd
Subject: [PHP-DB] Re: NEWBIE - Needs Assistance with Joins 


Cecily,
I'm sure you probably heard from others about your parse error. I know 
it looks weird, but you need to have two semicolons, so instead of:

 $CDList =mysql_query(
 SELECT artist_name, album_title .
 FROM artists, album_titles WHERE artist_id = aid);

you would have
$CDList =mysql_query(
SELECT artist_name, album_title .
FROM artists, album_titles WHERE artist_id = aid;);

(Note the semicolon after aid). This is because the first one is to 
complete the SQL statement, while the one after the parenthisis is to 
complete the PHP statement.

Vera
---
Madness takes its toll. Please have exact change.

Vera Algoet, Web Developer
Monterey County Office of Education
831-784-4169


-- 
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] Application-based locking with PHP?

2001-09-17 Thread Justin Buist

So long as you keep any referencial integrity from being broken by two
nearly simultaneous updates I don't really see much of a problem.  If two
users update a trouble ticket what's the big issue?  Perhaps a
notification could be displayed on the update confirmation page letting
one of the user's know that somebody else updated it while they also did.

Take a look at bugzilla -- it chugs along just fine it seems w/out any bug
locking mechanism.

Probably not the ansewr you were looking for, however if you're still
hellbent on getting a real locking mechanism in place you may wish to take
a look at SysV semaphores at http://www.php.net/manual/en/ref.sem.php.

Overkill solution
If you're familiar with using them in C you should be able to pick right
up on it; if not then you may wish to consult manpages of whatever OS
you're using (I assume *nix) for the C counterparts:

man 2 semget
man 2 semctl
man 2 semop
man 5 ipc
man 3 ftok

Even if you use them, which should be more trustworthy than DB locking,
you end up with the problem of unlocking it after the user has exited.
Perhaps you could use the shared memory functions to insert a timestamp at
which the semaphore expires, store that stamp in session variable, then
before the update compare the session variable with the value in shared
memory.  If they don't match they've lost their lock because they took too
long to update and somebody else now has the semaphore and is in control
of the update.  Rather than lock on the ablitity to update the DB though
you have to lock on the ability to look at and update the shared memory
segment.  I don't think PHP has an application-wide variable scope, so
shared memory is probably your only option.  And hey, if you're dealing
with SysV semaphores anyway you might as well just do the whole thing in a
SysV IPC style. :)
/Overkill Solution

If it's really -really- important, that's the only truly solid option I
see.  If it's not this important the I'd dump it, let people muddle with
the same ticket at once and let them sort their differences out later.

Justin Buist
Trident Technology, Inc.
4700 60th St. SW, Suite 102
Grand Rapids, MI  49512
Ph. 616.554.2700
Fx. 616.554.3331
Mo. 616.291.2612

On Mon, 17 Sep 2001, Barry L. Jeung wrote:

 Just wondering if anyone has tried doing quasi application based locking
 with PHP? My scenario is this. I'm constructing a database for my
 company to help keep track of trouble tickets, etc with a web-based
 frontend. I'm using PHP (obviously =]) for inputing/retrieving data and
 have a slight predicament. Since MySQL does table-level locking, if I
 put lock statements in my queries, it would cause two problems. One
 being the entire table being locked and two if the user just closes the
 webpage without exiting properly, the table would remain locked
 indefinately. So I'm trying to think of alternatives, one of which is
 using global variables to store table/record id's, and then evaluating
 the queries based on that information. So if John selects ticket # 5 and
 might be updating it, then when Bob attempts to select ticket #5, then
 the $id and $table variables would be checked against the variables
 stored when john placed his query, and bob would get a message saying
 that record #5 is locked or in-use by John and to try later. Is this
 feasible or is there a better way to do this? Thanks for your time.


 --
 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] PHP, Apache, and Solaris 8

2001-09-17 Thread Rick Gardner

Has anyone had any luck with installing php and apache on Solaris 8?
I am attempting to do so with Apache 1.3.20 and PHP 4.0.6.
When I attempt to launch ./apachectl start, I immediately get
Killed
./apachectl httpd: could not be started
If I compile apache without php support, it works like a champ, but if I 
try to include php support
--activate-module=src/modules/php4/libphp4.a
it dies immediately (as described above).
Absolutely nothing is written to error_log when this problem occurs.
Any suggestions or hints would be appreciated.

Rick

-- 
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] .plan (finger) scripts in PHP?

2001-09-17 Thread Brian Tegtmeier

What's up guys? I was just wondering if there is any PHP scripts floating around on 
the net that can serve and administer .plan files like how http://www.webdog.org, 
http://www.3dfinger.com and http://finger.stomped.com/ run theirs.

If I was looking for one that came the closest I was looking for, it would be the 
Webdog one. If any of you know of any scripts that will let me run a finger server on 
my machine with our without MySQL, then send me a holler. THX! :)
-- 

___
FREE Personalized E-mail at Mail.com
http://www.mail.com/?sr=signup

Talk More, Pay Less with Net2Phone Direct(R), up to 1500 minutes free!
http://www.net2phone.com/cgi-bin/link.cgi?143



-- 
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] NEWBIE - Needs Assistance with Joins

2001-09-17 Thread Jason Wong


- Original Message -
From: Cecily Walker Kidd [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, September 17, 2001 5:42 AM
Subject: [PHP-DB] NEWBIE - Needs Assistance with Joins


 Hello,

 I have two tables, one that contains an item id, album title name, and
 artist ID number. The second table is a list of artists, with an
 auto-increment artist ID.

 I want to join the two tables and have them output to a single PHP page.
 I was following along with the tutorial at
 http://www.webmasterbase.com/article/228/, and tried to modify it for my
 own needs.  When I do this, I get a parse error on the line that starts
 with SELECT.  Here's the code:

 $Link = mysql_connect ($Host, $User, $Password);

 $CDList =mysql_query(
 SELECT artist_name, album_title .
 FROM artists, album_titles WHERE artist_id = aid);


 What am I doing wrong?

 Thanks in advance.

Try:


$CDList = mysql_query(SELECT artist_name, album_title
 FROM artists, album_titles
WHERE artist_id = 'aid'
 );



hth
--
Jason Wong
Gremlins Associates
www.gremlins.com.hk
Tel: +852-2573-5033
Fax: +852-2573-5851




-- 
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] Quotes, double-quotes, and the like.

2001-09-17 Thread Ari M. Roth

I'm sorry -- what I meant was that the resulting link links to that.
The browser inserts http://localhost; to the beginning of the link as
if I had built a relative link rather than a specific complete one.  In
other words, the browser for some reason sees the double-quote as
another normal character rather than the opening and closing ends of a
link.

Here's the HTML for the form I use:

form method=post action=addnewrant_logic.php
span class=textTitle:/spanbr
input type=text name=title size=50nbsp;
input type=radio name=type value=r checked=on Randomnbsp;
input type=radio name=type value=c Currentbrbr

span class=textText:/spanbr
textarea name=text rows=30 cols=65/textareabrbr
input type=submit nbsp; input type=reset
/form

Here's the code to add the rant:

// Connect to the database and select the table we'll be using.
$db_link = mysql_connect(c831806-a, root, catls-9) or die (we
have no connection);
$db  = mysql_select_db(site, $db_link) or die (we have no
database);

$text  = str_replace(\n, br, $text);
$text  = addslashes($text);

$date = date(m/d/Y);

// Write out everything that we have.
echo hrDate: $datebr\nTitle: $titlebr\nType:
$typebr\nText:br\n$texthr;

$query  = INSERT INTO rants SET date=\$date\, category=\$type\,
title=\$title\, rtext=\$text\; 
$result = mysql_query($query, $db_link);
echo brbrbrResult: $result;

Thanks!

Later...

-Ari

-Original Message-
From: Justin Buist [mailto:[EMAIL PROTECTED]] 
Sent: Monday, September 17, 2001 8:32 AM
To: Ari M. Roth
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Quotes, double-quotes, and the like.


On Sun, 16 Sep 2001, Ari M. Roth wrote:

 I'm trying to create a web-based interface that will allow me to save 
 essays to a mySQL database for display on a website.  The problem is 
 that it may include HTML in it, so I need to preserve double-quotes in

 their original context.  Right now, they are not encoding correctly 
 for some reason.  An HTML link, for example, to http://www.yahoo.com 
 would come out as this:

 http://localhost/http://www.yahoo.com;

 addslashes() accomplished nothing, and I'm at a loss.  Any ideas?

You should probably paste the HTML form and perhaps the PHP code which
does the actual insersts -- it's completely illogical that
http://localhost/; would magically appear before a field name.  At
least in my book.

Justin Buist
Trident Technology, Inc.
4700 60th St. SW, Suite 102
Grand Rapids, MI  49512
Ph. 616.554.2700
Fx. 616.554.3331
Mo. 616.291.2612


--
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] .plan (finger) scripts in PHP?

2001-09-17 Thread Justin Buist

 If I was looking for one that came the closest I was looking for, it
 would be the Webdog one. If any of you know of any scripts that will
 let me run a finger server on my machine with our without MySQL, then
 send me a holler. THX! :) --

I assume you mean a PHP based finger client, not server.

Picked this out of the PHP-HOWTO on linuxdoc.org, modified it to work with
php4:

function finger ($host, $user)
{
$fp = fsockopen($host, 79, $errno, $errstr) or die($errno: $errstr);
fputs($fp, $user\n);
while (!feof($fp))
echo fgets($fp, 128);
fclose($fp);
}

Usage:
finger(idsoftware.com, zaphod);

Original URL: http://www.linuxdoc.org/HOWTO/PHP-HOWTO-19.html, it's in
Section 19.3.

Justin Buist
Trident Technology, Inc.
4700 60th St. SW, Suite 102
Grand Rapids, MI  49512
Ph. 616.554.2700
Fx. 616.554.3331
Mo. 616.291.2612


-- 
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] NEWBIE - Needs Assistance with Joins

2001-09-17 Thread Remo Pini

actually artist_id = 'aid' will not work, since you are comparing artist_id
with the string aid and not with the artists id in the second table...

from a sql point of view the statement

SELECT artist_name, album_title FROM artists, album_titles WHERE artist_id =
aid

is correct (if your names are UNIQUE and correct and if you only want 1:1
relations).

For starters you could write the statement as one of the following:

SELECT artists.artist_name, album_titles.album_title FROM artists LEFT JOIN
album_titles ON artists.artist_id = album_titles.aid

(might be RIGHT JOIN, I'm never sure...)

or if everything is unique:

SELECT artist_name, album_title FROM artists LEFT JOIN album_titles ON
artist_id = aid


Greets,

Remo

 -Original Message-
 From: Jason Wong [mailto:[EMAIL PROTECTED]]
 Sent: Monday, September 17, 2001 10:10 PM
 To: [EMAIL PROTECTED]; Cecily Walker Kidd
 Subject: Re: [PHP-DB] NEWBIE - Needs Assistance with Joins



 - Original Message -
 From: Cecily Walker Kidd [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Monday, September 17, 2001 5:42 AM
 Subject: [PHP-DB] NEWBIE - Needs Assistance with Joins


  Hello,
 
  I have two tables, one that contains an item id, album title name, and
  artist ID number. The second table is a list of artists, with an
  auto-increment artist ID.
 
  I want to join the two tables and have them output to a single PHP page.
  I was following along with the tutorial at
  http://www.webmasterbase.com/article/228/, and tried to modify it for my
  own needs.  When I do this, I get a parse error on the line that starts
  with SELECT.  Here's the code:
 
  $Link = mysql_connect ($Host, $User, $Password);
 
  $CDList =mysql_query(
  SELECT artist_name, album_title .
  FROM artists, album_titles WHERE artist_id = aid);
 
 
  What am I doing wrong?
 
  Thanks in advance.

 Try:

 
 $CDList = mysql_query(SELECT artist_name, album_title
  FROM artists, album_titles
 WHERE artist_id = 'aid'
  );
 


 hth
 --
 Jason Wong
 Gremlins Associates
 www.gremlins.com.hk
 Tel: +852-2573-5033
 Fax: +852-2573-5851




 --
 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] Application-based locking with PHP?

2001-09-17 Thread Barry L. Jeung

Justin/Matthew, thanks for your replys. After some more research, it
looks like MySQL does have some provisions for doing what I need, either
thru constructive queries which can emulate row/column leveling locking
as seen here:

http://www.mysql.com/doc/C/o/Commit-rollback.html

Or using cooperative advisory locking as mentioned here:

http://www.mysql.com/doc/M/i/Miscellaneous_functions.html

Regardless, this has become more of a MySQL list and I will post there
from now on. Just wanted to pass on my findings in case anyone else was
interested. Thanks for your time.


 -Original Message-
 From: Justin Buist [mailto:[EMAIL PROTECTED]]
 Sent: Monday, September 17, 2001 12:40 PM
 To: Barry L. Jeung
 Cc: [EMAIL PROTECTED]
 Subject: Re: [PHP-DB] Application-based locking with PHP?
 
 
 So long as you keep any referencial integrity from being broken by two
 nearly simultaneous updates I don't really see much of a 
 problem.  If two
 users update a trouble ticket what's the big issue?  Perhaps a
 notification could be displayed on the update confirmation 
 page letting
 one of the user's know that somebody else updated it while 
 they also did.
 
 Take a look at bugzilla -- it chugs along just fine it seems 
 w/out any bug
 locking mechanism.
 
 Probably not the ansewr you were looking for, however if you're still
 hellbent on getting a real locking mechanism in place you may 
 wish to take
 a look at SysV semaphores at http://www.php.net/manual/en/ref.sem.php.
 
 Overkill solution
 If you're familiar with using them in C you should be able to 
 pick right
 up on it; if not then you may wish to consult manpages of whatever OS
 you're using (I assume *nix) for the C counterparts:
 
 man 2 semget
 man 2 semctl
 man 2 semop
 man 5 ipc
 man 3 ftok
 
 Even if you use them, which should be more trustworthy than 
 DB locking,
 you end up with the problem of unlocking it after the user has exited.
 Perhaps you could use the shared memory functions to insert a 
 timestamp at
 which the semaphore expires, store that stamp in session 
 variable, then
 before the update compare the session variable with the value 
 in shared
 memory.  If they don't match they've lost their lock because 
 they took too
 long to update and somebody else now has the semaphore and is 
 in control
 of the update.  Rather than lock on the ablitity to update 
 the DB though
 you have to lock on the ability to look at and update the 
 shared memory
 segment.  I don't think PHP has an application-wide variable scope, so
 shared memory is probably your only option.  And hey, if 
 you're dealing
 with SysV semaphores anyway you might as well just do the 
 whole thing in a
 SysV IPC style. :)
 /Overkill Solution
 
 If it's really -really- important, that's the only truly 
 solid option I
 see.  If it's not this important the I'd dump it, let people 
 muddle with
 the same ticket at once and let them sort their differences out later.
 
 Justin Buist
 Trident Technology, Inc.
 4700 60th St. SW, Suite 102
 Grand Rapids, MI  49512
 Ph. 616.554.2700
 Fx. 616.554.3331
 Mo. 616.291.2612
 
 On Mon, 17 Sep 2001, Barry L. Jeung wrote:
 
  Just wondering if anyone has tried doing quasi application 
 based locking
  with PHP? My scenario is this. I'm constructing a database for my
  company to help keep track of trouble tickets, etc with a web-based
  frontend. I'm using PHP (obviously =]) for 
 inputing/retrieving data and
  have a slight predicament. Since MySQL does table-level 
 locking, if I
  put lock statements in my queries, it would cause two problems. One
  being the entire table being locked and two if the user 
 just closes the
  webpage without exiting properly, the table would remain locked
  indefinately. So I'm trying to think of alternatives, one 
 of which is
  using global variables to store table/record id's, and then 
 evaluating
  the queries based on that information. So if John selects 
 ticket # 5 and
  might be updating it, then when Bob attempts to select 
 ticket #5, then
  the $id and $table variables would be checked against the variables
  stored when john placed his query, and bob would get a 
 message saying
  that record #5 is locked or in-use by John and to try later. Is this
  feasible or is there a better way to do this? Thanks for your time.
 
 
  --
  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] include_path

2001-09-17 Thread Bas Jobsen

place connect.php in teh same dir as confirmregistration.php (/mall/)
- Original Message -
From: its me [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, September 18, 2001 12:50 AM
Subject: [PHP-DB] include_path


 Fatal error: Failed opening required 'connect.php'
(include_path='.:/usr/local/lib/php') in
/home/sites/site92/web/mall/confirmregistration.php on line 3


 and


 Fatal error: Failed opening required 'connect.php' (include_path='') in
/home/sites/site92/web/mall/confirmregistration.php on line 3


 and my script  is:

 ?php
 session_start();
 require(connect.php);
 ?



 so?



 
 

 --
 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] Re: Sybase CT with/without Sybase ASE

2001-09-17 Thread Richard H

When you compile php with sybase ct you specify where the libs are: $SYBASE/lib,
in ASE12.0 and above maybe the path differs from 11.9.2, I have not checked yet,
will tomorrow.

//dbaBert

Carlo Borreo wrote:

 Dear All,
 In the past I had installed an Apache server with PHP 4.0.6 and Sybase CT
 extension on Mandrake Linux 8, all ok.
 On the Mandrake machine, I had installed Sybase ASE 11.9.2, that was only
 used for test; most of the time the php code used sybase ct lib to refer to
 another database server (Sybase ASE 12.5 on Solaris), and all worked.
 But now I tried to update the test Sybase ASE database server on Mandrake
 from 11.9.2 from 12.5. I was not successful, but I could live without test
 database, so I didn't worry. But at next reboot, Apache was failing to start
 with this message:

 Syntax error on line 205 of /usr/local/apache/conf/httpd.conf:
 Cannot load /usr/local/apache/libexec/libphp4.so into server: libinsck.so:
 cannot load shared object file: No such file or directory
 /etc/init.d/httpd start: httpd could not be started

 The file libphp4.so is in place, but file libinschk.so is not on the
 machine.
 I thought that PHP and sybase ct didn't need a database server to be
 installed on the machine; was I wrong?
 I also tried uninstalling completely 12.5, but still Apache doesn't start.
 As I said, I can live without that database server, but I need Apache, Php,
 and Sybase ct, please help.

 Thanks in advance
 Carlo Borreo


-- 
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] db's war

2001-09-17 Thread Sommai Fongnamthip

hi
I'd like to survey php commnunity about how do you think about merge 
between informix and ibm?  Did there remain only 2 major dbms (oracle and 
db2)?  do you think MySQL will be the leader with next version 4?

SF


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