[PHP-DB] dbx question - specifying a port for pgsql

2002-09-27 Thread Jeff Van Campen

Hello,

We have been using dbx here at work, and it seems that it could be a very 
useful tool, since we use several DBMSs.

However, on one of our servers, we have to run Postgres on a port other than 
5432.  After reading the documentation and finding nothing there, I took a 
look at the source, and noticed that the port is hardcoded.  I was wondering 
if there are any plans to allow the spefication of a port via the dbx_connect 
funtion.

It looks to me that in dbx_mysql.c, you can use the MySQL 
host:port/host:socket syntax.  Is there any possibility that this syntax or 
a variation of it could be used throughout dbx?  

Thank you,

Jeff Van Campen

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




Re: [PHP-DB] [PHP-MySQL] lock a record of MySQL from PHP

2002-09-27 Thread Miles Thompson

1. Check MySQL syntax for locking a record
2. Build the query to do that, assigning it to something like $qry
3. mysql_query( $qry )
4. Check for results

HOWEVER - given that the web is a stateless environment, and a user can 
just close a browser, or walk away, or whatever, are you SURE you want to 
lock a record? An awful lot of db work can be done w/o express locking of 
records. You get an implicit lock on an UPDATE or INSERT.

I've not checked the MySLQ docs, but the classic way to see if a record is 
locked is to attempt a lock. I'd suggest reading up on the pro's and con's 
of locking, either in the MySQL docs or in a general book on SQL.

Hope this helps - Miles Thompson

At 12:11 PM 9/27/2002 +1000, Michael Wai wrote:
I'm a newbie of PHP and MySQL. Would anyone tell me that how to lock and
unlock a record of MySQL from PHP? And how other can detect whether this
record is locked or not?

Thanks for your help.

Regards,
Michael Wai




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




SV: [PHP-DB] Current row of query

2002-09-27 Thread Henrik Hornemann

Actually you dont need to keep track of the row number. Yoy could just
alternate the two colors like this:

while ( $row = mysql_fetch_array($result) )
 {
  $bgCol = ( $bgCol == #EADBC6}?#EFE1CE:#EADBC6;
  echo ..;
 }

hth Henrik Hornemann

-Oprindelig meddelelse-
Fra: Patrick Lebon [mailto:[EMAIL PROTECTED]]
Sendt: 26. september 2002 17:20
Til: [EMAIL PROTECTED]
Emne: Re: [PHP-DB] Current row of query


Thanks, im currently doing something similar to this but I was wondering if
there was an already defined variable that i could use rather then have to
create a value and increment it myself. I guess am being picky, but was just
curious as im new to php.

This is how im currently doing it...

 $rowNum = 0;
 while ( $row = mysql_fetch_array($result) )
 {
 $rowNum++;
 if ($rowNum % 2) { $bgCol = #EADBC6; } else { $bgCol = #EFE1CE; }
echo ..;
}


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




Re: [PHP-DB] Re: ODBC?

2002-09-27 Thread Andrew Hill

And if you are using ODBC from *nix, you will want to configure it 
--with-iodbc as per the HOWTO at www.iodbc.org.

Best regards,
Andrew Hill
Director of Technology Evangelism
OpenLink Software - http://www.openlinksw.com

On Tuesday, September 24, 2002, at 10:34 AM, Ever Lopez wrote:

 First make sure you have installed the MyODBC Driver
 Then make a odbc DSN to the MySQL database.

 Finally try something like this:

 odbc_connect($DSN_Name,$UserName, $Password) or die(Could not connect 
  to
 the datasource);

 Hope this helps...


 Chris Payne [EMAIL PROTECTED] escribiÛ en el mensaje
 000801c263d1$2cf7fec0$f7fea8c0@chris">news:000801c263d1$2cf7fec0$f7fea8c0@chris...
 Hi there everyone,

 I have always used MySQL with PHP without any problems using the 
 standard
 MySQL connection functionality.  Is it possible to connect to a MySQL 
 DB via
 ODBC?   If so, what would the PHP Connection string be?  I am curious 
 as my
 email server allows you to use external databases for users accounts 
 and I
 figure this way I could write a PHP script to control users email 
 accounts.

 Thanks everyone, sorry if this sounds like a stupid question, not used 
 ODBC
 before so even though I know quite abit about PHP/MySQL, I know diddly 
 about
 ODBC :-)

 Chris Payne



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

2002-09-27 Thread Steve Vernon



Hiya,
 I am doing a database of things that have dates, some I 
know the month and year of, some I only know the year. I suppose I could do a 
field for the year, and one for month, and then allow the month to be NULL. But 
is there a date type that allows years and / or months??? 

 Thanks,


 Steve


   _.-..-```---._..``\--.._
   ../\```-._ ``-._
 _/_ o \  _.-```.``.  \`-._   _=-.
_.-`\_\ \ o `.(_`.__./ /   |--``-`._##.`
  -` \ o  `.   `-``  _`  o  \#//
 / \ _.._ \ o _.`--``  _.-`\_.\-`\
 | .|`-.___\-` o__.-._. `._..-`` `.\
 |/ \__...--`.-`\.-`_.--`. |)
 |  _|.-``\``_...-``\  /`.   `.   `.  //
  \/.#.`=._ /_   \ \  `._/ \`//
   \`#`_.--`|_`--.\ __  `.  \\_  `. `.`.
```   `--._|__\  `.`._.\-`\ \
  `\   \ \  `. ` \
`.  `.`.  \ | \
  `.  \ ``-~`  \
`. \   _..-`
  `-```
Stephen Vernon, recently graduated from the University of Sheffield, where I 
studied Computer Science. I could do with a job!

  
  
Stephen Vernon

  

  
Mobile
07971 446 956 
  
Mobile
07971 446 956  


[PHP-DB] Flush database

2002-09-27 Thread wade

I am storing IP addresses in a database, but after an hour has passed I
want to delete all the IP addresses from that database. I want to do
this based on the server time. Example.. Someone comes to my web page, I
store their IP address in my database. So now I write a PHP script that
says if that IP returns to my page within an hour, they can't view my
page. If they come back after an hour has passed they can view the
contents of that page. but only after an hour has passed.

Can anyone help me with the syntax or functions that will clear the
database after an hour of waiting has passed?
Is this possible? Any suggestions, logic or any help on this matter will
be greatly appreciated.

Thank you

--
Should you have any questions, comments or concerns, feel free to call
me at 318-338-2033.

Thank you for your time,

Wade Kelley, Design Engineer

Bayou Internet...(888) 30-BAYOU...http://www.bayou.com
Mississippi Internet...(800) MISSISSIPPI...http://www.mississippi.net
Vicksburg Online...(800) MISSISSIPPI...http://www.vicksburg.com





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




Re: [PHP-DB] Dates

2002-09-27 Thread Micah Stevens


May I recommend setting the field type to INT, and just using timestamps? 
That's what I usually do, then you can manipulate things however you want. 
Much more convenient than the date style type I think. Looking at how the 
MySQL docs talk about the DATETIME field, I bet the database is doing just 
that, but converting for you. If you use the PHP date/time functions 
instead to convert you have a lot more control.

-Micah


At 09:38 PM 9/27/2002 +0100, Steve Vernon wrote:
Hiya,
 I am doing a database of things that have dates, some I know the 
 month and year of, some I only know the year. I suppose I could do a 
 field for the year, and one for month, and then allow the month to be 
 NULL. But is there a date type that allows years and  / or months???

 Thanks,


 Steve

--



   _.-..-```---._..``\--.._
../\```-._ ``-._
  _/_ o \  _.-```.``.  \`-._   _=-.
 _.-`\_\ \ o `.(_`.__./ /   |--``-`._##.`
   -` \ o  `.   `-``  _`  o  \#//
  / \ _.._ \ o _.`--``  _.-`\_.\-`\
  | .|`-.___\-` o__.-._. `._..-`` `.\
  |/ \__...--`.-`\.-`_.--`. |)
  |  _|.-``\``_...-``\  /`.   `.   `.  //
   \/.#.`=._ /_   \ \  `._/ \`//
\`#`_.--`|_`--.\ __  `.  \\_  `. `.`.
 ```   `--._|__\  `.`._.\-`\ \
   `\   \ \  `. ` \
 `.  `.`.  \ | \
   `.  \ ``-~`  \
 `. \   _..-`
   `-```
Stephen Vernon, recently graduated from the University of Sheffield, where 
I studied Computer Science. I could do with a job!
Stephen Vernon
Mobile 07971 446 956
Mobile 07971 446 956




Re: [PHP-DB] Flush database

2002-09-27 Thread Ignatius Reilly

why not simply store the server time at log in in the DB after a successful
log in together with the IP address; and at the next log in request perform
a SQL time difference comparison?

Ignatius

- Original Message -
From: wade [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, September 27, 2002 10:53 PM
Subject: [PHP-DB] Flush database


 I am storing IP addresses in a database, but after an hour has passed I
 want to delete all the IP addresses from that database. I want to do
 this based on the server time. Example.. Someone comes to my web page, I
 store their IP address in my database. So now I write a PHP script that
 says if that IP returns to my page within an hour, they can't view my
 page. If they come back after an hour has passed they can view the
 contents of that page. but only after an hour has passed.

 Can anyone help me with the syntax or functions that will clear the
 database after an hour of waiting has passed?
 Is this possible? Any suggestions, logic or any help on this matter will
 be greatly appreciated.

 Thank you

 --
 Should you have any questions, comments or concerns, feel free to call
 me at 318-338-2033.

 Thank you for your time,

 Wade Kelley, Design Engineer
 
 Bayou Internet...(888) 30-BAYOU...http://www.bayou.com
 Mississippi Internet...(800) MISSISSIPPI...http://www.mississippi.net
 Vicksburg Online...(800) MISSISSIPPI...http://www.vicksburg.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] Flush database

2002-09-27 Thread Brad Bonkoski

How about writting the IP address to the database with a timestamp,
then when a matching IP address arrives you view the timestamp and if it has
been more then a hour, they can view the page, which would force you to
update the timestamp.  Of course you would probably need to write a
stand-alone (i.e. non-web) php script that would act as a cron job to clean
out the database periodically, whatever period you define (depending on
traffic and size of DB).

-Brad
wade wrote:

 I am storing IP addresses in a database, but after an hour has passed I
 want to delete all the IP addresses from that database. I want to do
 this based on the server time. Example.. Someone comes to my web page, I
 store their IP address in my database. So now I write a PHP script that
 says if that IP returns to my page within an hour, they can't view my
 page. If they come back after an hour has passed they can view the
 contents of that page. but only after an hour has passed.

 Can anyone help me with the syntax or functions that will clear the
 database after an hour of waiting has passed?
 Is this possible? Any suggestions, logic or any help on this matter will
 be greatly appreciated.

 Thank you

 --
 Should you have any questions, comments or concerns, feel free to call
 me at 318-338-2033.

 Thank you for your time,

 Wade Kelley, Design Engineer
 
 Bayou Internet...(888) 30-BAYOU...http://www.bayou.com
 Mississippi Internet...(800) MISSISSIPPI...http://www.mississippi.net
 Vicksburg Online...(800) MISSISSIPPI...http://www.vicksburg.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] Flush database

2002-09-27 Thread Jim Hunter

First make sure that you are storing the IP and the time it was saved in the
database.
Then I would have 3 queries:
1) a query to see if the IP address is in the database and less then an hour
old.
2) a query to save the IP and time into the database
3) a query to delete all entries over 1 hour old.

Then when you get a new visitor see if the IP address is in the database and
is not less then 1 hour old. Once it clears that test, save the IP and time,
then always run the delete query to clear out entries. If you have a lot of
traffic to your site you are going to generate a lot of database hits. 

Good luck.
Jim
 
---Original Message---
 
From: wade
Date: Friday, September 27, 2002 02:02:50 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Flush database
 
I am storing IP addresses in a database, but after an hour has passed I
want to delete all the IP addresses from that database. I want to do
this based on the server time. Example.. Someone comes to my web page, I
store their IP address in my database. So now I write a PHP script that
says if that IP returns to my page within an hour, they can't view my
page. If they come back after an hour has passed they can view the
contents of that page. but only after an hour has passed.

Can anyone help me with the syntax or functions that will clear the
database after an hour of waiting has passed?
Is this possible? Any suggestions, logic or any help on this matter will
be greatly appreciated.

Thank you

--
Should you have any questions, comments or concerns, feel free to call
me at 318-338-2033.

Thank you for your time,

Wade Kelley, Design Engineer

Bayou Internet...(888) 30-BAYOU...http://www.bayou.com
Mississippi Internet...(800) MISSISSIPPI...http://www.mississippi.net
Vicksburg Online...(800) MISSISSIPPI...http://www.vicksburg.com





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

. 


Re: [PHP-DB] Flush database

2002-09-27 Thread Brad Bonkoski

Sounds like we are all on similar pages with timestamping, but if you issue a
delete query every time the page is viewed it could create some sub-par
performance based on number of hits.  i.e. if the site gets 100 hits in the
first 10 minutes of operation, it would issue delete logic and queries 100
times, but since they are all *new* the logic would not really do anything,
right?  So, depening on what kind of traffic you plan to generate a cron job may
be your best bet, if you plan to generate a whoel bunch, you may even need to
kick it off every hour.

-or- you could use this logic, but store in a different table a timestamp for
last delete and every time view that timestamp, and if more then a hour has
passed, then go ahead with your database clean-up routine.

-Brad


Jim Hunter wrote:

 First make sure that you are storing the IP and the time it was saved in the
 database.

 Then I would have 3 queries:

 1) a query to see if the IP address is in the database and less then an hour
 old.

 2) a query to save the IP and time into the database

 3) a query to delete all entries over 1 hour old.

 Then when you get a new visitor see if the IP address is in the database and
 is not less then 1 hour old. Once it clears that test, save the IP and time,
 then always run the delete query to clear out entries. If you have a lot of
 traffic to your site you are going to generate a lot of database hits.

 Good luck.

 Jim



 ---Original Message---



 From: wade

 Date: Friday, September 27, 2002 02:02:50 PM

 To: [EMAIL PROTECTED]

 Subject: [PHP-DB] Flush database



 I am storing IP addresses in a database, but after an hour has passed I

 want to delete all the IP addresses from that database. I want to do

 this based on the server time. Example.. Someone comes to my web page, I

 store their IP address in my database. So now I write a PHP script that

 says if that IP returns to my page within an hour, they can't view my

 page. If they come back after an hour has passed they can view the

 contents of that page. but only after an hour has passed.

 Can anyone help me with the syntax or functions that will clear the

 database after an hour of waiting has passed?

 Is this possible? Any suggestions, logic or any help on this matter will

 be greatly appreciated.

 Thank you

 --

 Should you have any questions, comments or concerns, feel free to call

 me at 318-338-2033.

 Thank you for your time,

 Wade Kelley, Design Engineer

 

 Bayou Internet...(888) 30-BAYOU...http://www.bayou.com

 Mississippi Internet...(800) MISSISSIPPI...http://www.mississippi.net

 Vicksburg Online...(800) MISSISSIPPI...http://www.vicksburg.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




[PHP-DB] Flush database

2002-09-27 Thread wade

So how would one compare the timestamp?
how would you write
if timestamp is greater than timestamp + 1 hour
{
Ok to view page
run query to update that IP to new timestamp -- I think this will
be better than a delete statement
}
else
{
Can't view page
}


I know you will have to compare the timestamps. the one in the database
against the current hit.
How would one do this comparison?






--
Should you have any questions, comments or concerns, feel free to call
me at 318-338-2033.

Thank you for your time,

Wade Kelley, Design Engineer

Bayou Internet...(888) 30-BAYOU...http://www.bayou.com
Mississippi Internet...(800) MISSISSIPPI...http://www.mississippi.net
Vicksburg Online...(800) MISSISSIPPI...http://www.vicksburg.com





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




RE: [PHP-DB] Dates

2002-09-27 Thread John Holmes

    I am doing a database of things that have dates, some I know the
month and year of, some I only know the year. I suppose I could do a
field for the year, and one for month, and then allow the month to be
NULL. But is there a date type that allows years and  / or months??? 

If that's all you have is a year, or a year-month, then you don't have a
date. You have and year and you have a month. Use an integer or text
column to store it, and process it with PHP.

---John Holmes... 


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




Re: [PHP-DB] Flush database

2002-09-27 Thread Micah Stevens

Using UNIX timestamps:


if (time() - $timestamp  mktime(1,0,0,0,0,0)) {
 //  Difference it greater than one hour. Perform rejection 
code here
} else {
 // Difference is one hour or less. Perform acception code here.
}







At 04:35 PM 9/27/2002 -0500, wade wrote:
So how would one compare the timestamp?
how would you write
if timestamp is greater than timestamp + 1 hour
 {
 Ok to view page
 run query to update that IP to new timestamp -- I think this will
be better than a delete statement
 }
 else
 {
 Can't view page
 }


I know you will have to compare the timestamps. the one in the database
against the current hit.
How would one do this comparison?






--
Should you have any questions, comments or concerns, feel free to call
me at 318-338-2033.

Thank you for your time,

Wade Kelley, Design Engineer

Bayou Internet...(888) 30-BAYOU...http://www.bayou.com
Mississippi Internet...(800) MISSISSIPPI...http://www.mississippi.net
Vicksburg Online...(800) MISSISSIPPI...http://www.vicksburg.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