Re: [PHP-DB] Automating Date in mySQL

2002-02-03 Thread Jason Wong

On Sunday 03 February 2002 03:47, Todd Williamsen wrote:
 I want the date to automatically be updated.  So if a post was made on
 2/10/2001 I would like it to put it automatically in the database.

 I do have a column called Date and the datatype is set to date.  But when
 I add a record even if the sql states to insert the date it doesn't, or
 does the date need to be manually added?

Use a field of the type Timestamp -- it updates automatically whenever the 
record is updated.


-- 
Jason Wong - Gremlins Associates - www.gremlins.com.hk

/*
The only difference in the game of love over the last few thousand years
is that they've changed trumps from clubs to diamonds.
-- The Indianapolis Star
*/

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




[PHP-DB] Cannot include file

2002-02-03 Thread Hayan Al Mamoun

Hi sirs, I'm trying to run include() function to include a page from a
different website, but it fails :
include(http://remote/dawn-travel/lists/somelongnumber.xml;);
remote is windows NT4 IIS
I got the following error,
Warning: Failed opening
'http://remote/dawn-travel/lists/34f3542a4c90f2e183891192c8225e37.xml' for
inclusion (include_path='') in D:\New
Folder\wwwroot\w.dawncreative.com\progs\hotelrates\list.phtml on line 6

What's wrong please




Best Regards
Hayan



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




[PHP-DB] Cannot Include File..

2002-02-03 Thread Hayan Al Mamoun

Hi sirs, I'm trying to run include() function to include a page from a
different website, but it fails :
include(http://remote/dawn-travel/lists/somelongnumber.xml;);
remote is windows NT4 IIS
I got the following error,
Warning: Failed opening
'http://remote/dawn-travel/lists/34f3542a4c90f2e183891192c8225e37.xml' for
inclusion (include_path='') in D:\New
Folder\wwwroot\w.dawncreative.com\progs\hotelrates\list.phtml on line 6

What's wrong please




Best Regards
Hayan



Best Regards
Hayan


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




[PHP-DB] Re: Poisoned Persistent OCI8 Connections

2002-02-03 Thread John Lim

Hi,

I don't have a direct solution to the problem, but I would use Oracle's
Multi-Threaded Server and switch to using normal non-persistent PHP
connections. Eg. rely on Oracle to do the connection pooling instead
of PHP.

My benchmarks suggest that this is quite an efficient method of
connecting for short queries.

Regards, John

Hz11 [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 I have PHP 4.0.6 compiled as an Apache 1.3.20 module with OCI8 and MySQL
 on RedHat 6.2.  I use persistent connections with OCI8 to avoid the
 costly connection construction for Oracle for each request.  However, I
 notice that these persistent connections get poisoned under certain
 circumstances.  What I mean by this is this:

 Since each persistent connection stays with it's corresponding Apache
 process, if the database happens to be down when a request comes in, the
 persistent connection that is used throws an ORA-03113.  However, even
 when the database comes back, the persistent connection still thinks the
 database is down somehow, and will continue to throw the ORA-03113
 error.  As a result, if a request happens to hit the poisoned Apache
 process, it appears the database is down.  If a request hits another
 Apache process, all is OK.

 So far, the only way I've seen to deal this is to restart Apache, and
 have the persistent connections build up again.  Obviously, this is not
 a good thing, and if the database should go down again, the persistent
 connections get poisoned again, and the cycle begins.

 How can this be dealt with?  Any help would be great, as customers don't
 like having to refresh the page to avoid error messages.  If any more
 info or clarification is needed please contact me.

 Thank you,

 Hans





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




[PHP-DB] LEFT JOIN in UPDATE

2002-02-03 Thread Adv. Systems Design

hi...trying to circumvent the limitation of the DELETE
statement only being able to use its own table...idea
is to mark the records to be deleted via an UPDATE
statement which allegedly accepts LEFT JOIN and then
performing the DELETE statement.

Question is how to properly form a LEFT JOIN using
UPDATE... I tried:

UPDATE product_price LEFT JOIN temp 
SET product_price.product_price_vdate = 1 (del flag)
ON product_price.product_id = temp.product_id
WHERE temp.product_id IS NOT NULL

as well as some other combos...to no avail! Anyone
used this know the right syntax much appreciated!!!

Luis


=

Make it idiot-proof and someone will make a better idiot.

__
Do You Yahoo!?
Great stuff seeking new owners in Yahoo! Auctions! 
http://auctions.yahoo.com

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




[PHP-DB] Re: LEFT JOIN in UPDATE

2002-02-03 Thread Lutz Brückner


[EMAIL PROTECTED] (Adv. Systems Design) writes:

 Question is how to properly form a LEFT JOIN using
 UPDATE... I tried:
 
 UPDATE product_price LEFT JOIN temp 
 SET product_price.product_price_vdate = 1 (del flag)
 ON product_price.product_id = temp.product_id
 WHERE temp.product_id IS NOT NULL

I just read http://www.mysql.com/doc/U/P/UPDATE.html once more,
but can not find anything about mysql supporting JOIN in UPDATE
statements.

Sorry,
 Lutz

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




[PHP-DB] display a waiting loop while searching the db?

2002-02-03 Thread Andy

Hi guys,

I would like to display something like: please wait, searching while I am
making a querry or other stuff which takes a while. After the work is done,
it should redirect to another page displaying the result.

As far as I know the HEADER location satement is only valid if there is no
output in front. So I can't just echo the sentence.

Does anybody know the trick?

Thanx for your help.

Cheers Andy



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




[PHP-DB] Is ODBC now the Native interface for MS-SQL7/2000 ?

2002-02-03 Thread Oliver Cronk


 After looking at the newsgroup microsoft.public.sqlserver.odbc I came
across
 the follwing piece of information - anyone know if it is true?  It would
 certainly explain a few things (why we can only get 255 chars out of
 varchars etc).  Should I move my code over to ODBC?  I have tried but the
 ODBC driver appears to lack any decent output (-1) for the odbc_num_rows
 function - which breaks my existing code (it performs checks on the amount
of
 rows).

 Anyone have any information about this?  Should I talk to the developer(s)
of
 the MSSQL extension do you think?  IF it is true then the php docs should
at
 least illustrate this point as a warning.

 [start of ms post]
 They don't provide one because db-lib is a dead interface and hasn't been
 upgraded in 5+ years now.

  fyi - ODBC and OLE-DB *ARE* native interfaces to SQL Server - it is these
 you
 should be using.

 [person who asked the question wrote]
  Why has Microsoft not provided a new ntwdblib.dll file for SQL Server
 2000?
  Clients, such as Crystal, rely on this being valid for the current
 database.
  Crystal provides p2ssql.dll that communicates with ntwdblib.dll.  Since
  ntwdblib.dll was last updated with SQL Server 6.5, the p2ssql.dll driver
  fails for clients.
 
  For example, column names  30 chars in length don't work in Crystal if
 you
  use the p2ssql.dll driver (that communicates with the very outdated
  ntwdblib.dll library).  There are several other issues with this as well.
 
  As a result, clients such as Crystal must use a more generic ODBC driver
  (p2sodbc.dll).  That works fine, but why doesn't MS provide a current
 NATIVE
  driver to work with SQL Server 2000?  Where can I get a NEW ntwdblib.dll
 to
  install?  I installed the latest MDAC and that didn't solve the problem.
  Thanks.

 [end of ms post]

 Thanks for any pointers anyone throws up.

 Oliver Cronk

 p.s. this was found under the thread Re: ntwdblib.dll (Native vs. ODBC
 driver) on microsoft.public.sqlserver.odbc over the last couple of days
(and
 so should still be there if anyone else wants to look at the entire
thread).





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




Re: [PHP-DB] Re: LEFT JOIN in UPDATE

2002-02-03 Thread Paul Burney

on 2/3/02 3:36 PM, Lutz Brückner at [EMAIL PROTECTED] appended the following
bits to my mbox:

 Question is how to properly form a LEFT JOIN using
 UPDATE... I tried:
 
 UPDATE product_price LEFT JOIN temp
 SET product_price.product_price_vdate = 1 (del flag)
 ON product_price.product_id = temp.product_id
 WHERE temp.product_id IS NOT NULL

 I just read http://www.mysql.com/doc/U/P/UPDATE.html once more,
 but can not find anything about mysql supporting JOIN in UPDATE
 statements.

I believe Lutz is right.  You are using PHP, right?  Any MySQL?

Some RDBMS systems provide ways of linking database table records to each
other via foreign keys and others allow you to create triggers that are
performed by the database server when certain actions happen.

MySQL does not.  They believe the application programmer should take care of
those application pieces.

So, if you're using MySQL, do the select statement first with the join, then
loop through the results and perform the update.

Paul

?php
while ($self != asleep) {
$sheep_count++;
}
?



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




[PHP-DB] How to Insert Database Information into an E-mail

2002-02-03 Thread David Sugar


I am working on a rideboard and I am trying to figure out how to take information from 
a mysql database and place it in the e-mail I am trying to send out.

Basically I want the e-mail to look similar to this:

Name:  John Doe
Phone: 555-
State: New York

and so on.  

Anyway the mail function in my php script looks as follows:

mail($emailwanted,$SubjectWanted,$BodyWanted,From: [EMAIL PROTECTED]);

The $emailwanted is the address to where I am sending the e-mail.
The $SubjectWanted is the subject of the e-mail.
The $BodyWanted is the body and this is where I want to insert the information from 
the database in the format described above.  I know how to get information from the 
database and print it out though I want $BodyWanted contain the information as above.  
Any suggestions would be appreciated.  Thanks for the help.

David Sugar

DOIT certifies this message is virus free.  If a virus was removed the sender will be  
automatically notified.



[PHP-DB] FIle Uploading to database

2002-02-03 Thread Todd Williamsen

I don't want the file to be stored in the database, but its location.

What I want to do:

Upload a file, it gets stored on the webserver, but its location on the
server is stored in the database.

Where do I look for something like this?

What data type would I use to store the URL or file location?

Thank you



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




Re: [PHP-DB] Is ODBC now the Native interface for MS-SQL7/2000 ?

2002-02-03 Thread Brian Bruns


Technically, it is not the dblib interface that limits you to 255 
character varchars.  TDS (tabular datastream, the on the wire protocol) 
version 4.2 (the version used upto SQL Server 6.5) is limited to a single 
byte size field and thus 255 characters (0 represents NULL).  The problem 
is that MS seems not to support dblib at any other protocol revision that 
would support it (7.0, 8.0).  So, yes, ODBC or OLE-DB would be the only 
support way of accessing large varchars.  Part of the problem resides in 
the fact that TDS 7 and above ships data in unicode (UCS-2) and converting 
to single byte representation for dblib is a pain.

The one workaround I know of is to issue your query like SELECT 
convert(text, mycol) FROM mytable that forces the large varchar to a text 
datatype and allows you to pull it from TDS 4.2.

Under Unix you may use FreeTDS where we allow you to use dblib with TDS 7.
But that's a story for another day. ;-)

Brian

On Sun, 3 Feb 2002, Oliver Cronk wrote:

 
  After looking at the newsgroup microsoft.public.sqlserver.odbc I came
 across
  the follwing piece of information - anyone know if it is true?  It would
  certainly explain a few things (why we can only get 255 chars out of
  varchars etc).  Should I move my code over to ODBC?  I have tried but the
  ODBC driver appears to lack any decent output (-1) for the odbc_num_rows
  function - which breaks my existing code (it performs checks on the amount
 of
  rows).
 
  Anyone have any information about this?  Should I talk to the developer(s)
 of
  the MSSQL extension do you think?  IF it is true then the php docs should
 at
  least illustrate this point as a warning.
 
  [start of ms post]
  They don't provide one because db-lib is a dead interface and hasn't been
  upgraded in 5+ years now.
 
   fyi - ODBC and OLE-DB *ARE* native interfaces to SQL Server - it is these
  you
  should be using.
 
  [person who asked the question wrote]
   Why has Microsoft not provided a new ntwdblib.dll file for SQL Server
  2000?
   Clients, such as Crystal, rely on this being valid for the current
  database.
   Crystal provides p2ssql.dll that communicates with ntwdblib.dll.  Since
   ntwdblib.dll was last updated with SQL Server 6.5, the p2ssql.dll driver
   fails for clients.
  
   For example, column names  30 chars in length don't work in Crystal if
  you
   use the p2ssql.dll driver (that communicates with the very outdated
   ntwdblib.dll library).  There are several other issues with this as well.
  
   As a result, clients such as Crystal must use a more generic ODBC driver
   (p2sodbc.dll).  That works fine, but why doesn't MS provide a current
  NATIVE
   driver to work with SQL Server 2000?  Where can I get a NEW ntwdblib.dll
  to
   install?  I installed the latest MDAC and that didn't solve the problem.
   Thanks.
 
  [end of ms post]
 
  Thanks for any pointers anyone throws up.
 
  Oliver Cronk
 
  p.s. this was found under the thread Re: ntwdblib.dll (Native vs. ODBC
  driver) on microsoft.public.sqlserver.odbc over the last couple of days
 (and
  so should still be there if anyone else wants to look at the entire
 thread).


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




RE: [PHP-DB] FIle Uploading to database

2002-02-03 Thread Dan Brunner

Hello!!!

You can do something like this


$pat = array(#, @, *, , %, @,$,',`);
$w= '_';
$pic_name2 = str_replace ($pat, $w, stripslashes($pic_name));



$query = INSERT INTO Travel_Design (Tavel_Design, Design_Name,
Season, Date, name, filesize, filetype ) VALUES ( '$Tavel_Design',
'$Design_Name', '$Season', '$Date', '$pic_name2', '$pic_size',
'$pic_type');



exec(cp '$pic' '/images/$pic_name2');



The First part is for taking out certain characters.

The Second is for inserting the data...Including the File parameters.

The Third part is the command to cp the TMP file where it needs to
be...with the file name of $pic_name2...

All you're storing is the Pictures Name, Size, and Type



And you would do something like this for the img tag...


...
echo (td bgcolor=white valign=middle colspan=2p align=centerimg
src='images/$data-name' width=180 height=249/p/td/tr\n);
... 

$data-name is the mysql field for the Picture Name..


I use mysql_fetch_object for retrieving my data...I'm sure it would work
for mysql_fetch_array and mysql_fetch_row.


I run Linux...so I don't know if the exec() will work if your on
windoze


Good Luck!!!


Dan




-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] 
Sent: Sunday, February 03, 2002 4:14 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] FIle Uploading to database

I don't want the file to be stored in the database, but its location.

What I want to do:

Upload a file, it gets stored on the webserver, but its location on the
server is stored in the database.

Where do I look for something like this?

What data type would I use to store the URL or file location?

Thank you



-- 
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] Image Operations with MySQL

2002-02-03 Thread Tim Lan

Hi,

I want to save and load images as binaries with a MySQL database, but I'm
not sure how to do it.  I'm sure this is a very dumb question, but forgive
me for being a newbie =)


Tim



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




[PHP-DB] Re: FIle Uploading to database

2002-02-03 Thread Todd Williamsen

Well...  thanks to Dan Burner for the script...  BUT

I cannot get this friggin INSERT statement to execute..  which craps out..
I cannot figure it out.  I have been staring at it for about an hour and I
still cannot figure it out

here it is:

$db = @mysql_select_db($db_name, $connection) or die(Could not select
database);
$query = INSERT INTO Canidate(FirstName, LastName, Industry, Address1,
Address2, City, State, Zip, LocationPref, Phone, Email, ResumeUp) VALUES
('$FirstName', '$LastName', '$Industry' '$Address1', 'Address2', '$City',
'$State', '$Zip', '$LocationPref', '$Phone', '$Email', '$ResumeUp2');
$result = @mysql_query($query, $connection) or die(could not execute
query);
$pat = array(#, @, *, , %, @,$,',`);
$w= '_';
$ResumeUp2 = str_replace ($pat, $w, stripslashes($ResumeUp));
exec(cp '$ResumeUp' '/resumes/$ResumeUp2');
?

it errors out on the $result could not execute query

Let me know if you need more info!

Thank you!


Todd Williamsen [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 I don't want the file to be stored in the database, but its location.

 What I want to do:

 Upload a file, it gets stored on the webserver, but its location on the
 server is stored in the database.

 Where do I look for something like this?

 What data type would I use to store the URL or file location?

 Thank you





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




[PHP-DB] mass insert to database

2002-02-03 Thread J-E-N

hello all,


i'm trying to make a script where i can do a mass insert to database (4,000 entries) 
and then send confirmation email to each of the entry's email address stating that 
their record has been inserted to database. My problem is, when i use a while loop the 
page time-out on the 300th entry. please help.

thanx



[PHP-DB] RE: FIle Uploading to database

2002-02-03 Thread Adam Royle

You missed the SET parameter in your query... example is below...

$query = INSERT INTO Canidate SET (FirstName, LastName, Indus...

Adam

-Original Message-
From: Todd Williamsen [mailto:[EMAIL PROTECTED]]
Sent: Monday, February 04, 2002 11:06 AM
To: [EMAIL PROTECTED]
Subject: Re: FIle Uploading to database


Well...  thanks to Dan Burner for the script...  BUT

I cannot get this friggin INSERT statement to execute..  which craps out..
I cannot figure it out.  I have been staring at it for about an hour and I
still cannot figure it out

here it is:

$db = @mysql_select_db($db_name, $connection) or die(Could not select
database);
$query = INSERT INTO Canidate(FirstName, LastName, Industry, Address1,
Address2, City, State, Zip, LocationPref, Phone, Email, ResumeUp) VALUES
('$FirstName', '$LastName', '$Industry' '$Address1', 'Address2', '$City',
'$State', '$Zip', '$LocationPref', '$Phone', '$Email', '$ResumeUp2');
$result = @mysql_query($query, $connection) or die(could not execute
query);
$pat = array(#, @, *, , %, @,$,',`);
$w= '_';
$ResumeUp2 = str_replace ($pat, $w, stripslashes($ResumeUp));
exec(cp '$ResumeUp' '/resumes/$ResumeUp2');
?

it errors out on the $result could not execute query

Let me know if you need more info!

Thank you!




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




[PHP-DB] Re: FIle Uploading to database

2002-02-03 Thread Todd Williamsen

Umm..

SET parameter is for the UPDATE query


Adam Royle [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 You missed the SET parameter in your query... example is below...

 $query = INSERT INTO Canidate SET (FirstName, LastName, Indus...

 Adam

 -Original Message-
 From: Todd Williamsen [mailto:[EMAIL PROTECTED]]
 Sent: Monday, February 04, 2002 11:06 AM
 To: [EMAIL PROTECTED]
 Subject: Re: FIle Uploading to database


 Well...  thanks to Dan Burner for the script...  BUT

 I cannot get this friggin INSERT statement to execute..  which craps out..
 I cannot figure it out.  I have been staring at it for about an hour and I
 still cannot figure it out

 here it is:

 $db = @mysql_select_db($db_name, $connection) or die(Could not select
 database);
 $query = INSERT INTO Canidate(FirstName, LastName, Industry, Address1,
 Address2, City, State, Zip, LocationPref, Phone, Email, ResumeUp) VALUES
 ('$FirstName', '$LastName', '$Industry' '$Address1', 'Address2', '$City',
 '$State', '$Zip', '$LocationPref', '$Phone', '$Email', '$ResumeUp2');
 $result = @mysql_query($query, $connection) or die(could not execute
 query);
 $pat = array(#, @, *, , %, @,$,',`);
 $w= '_';
 $ResumeUp2 = str_replace ($pat, $w, stripslashes($ResumeUp));
 exec(cp '$ResumeUp' '/resumes/$ResumeUp2');
 ?

 it errors out on the $result could not execute query

 Let me know if you need more info!

 Thank you!






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




[PHP-DB] Random numbers?

2002-02-03 Thread Chris Payne

Hi there everyone,

I need to generate a random number between 1 and 15 for insertion into a DB, I can 
easily do the DB side of it but what is the best method for quickly generating a 
random number between 1 and 15 (including 1 and 15 in the equation)?

Thanks for all your help.

Regards

Chris

www.planetoxygenet.com



Re: [PHP-DB] Random numbers?

2002-02-03 Thread Patrik Wallstrom

On sön, 03 feb 2002, Chris Payne wrote:

 Hi there everyone,
 
 I need to generate a random number between 1 and 15 for insertion into a 
 DB, I can easily do the DB side of it but what is the best method for
 quickly generating a random number between 1 and 15 (including 1 and 15  
 in the equation)?

srand((double)microtime()*100);
$randomnumber = rand(1,15);

Something like this?

--
patrik_wallstrom-foodfight-[EMAIL PROTECTED]+46-709580442

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




Re: [PHP-DB] Random numbers?

2002-02-03 Thread Chris Payne

Hi there,

That is absolutely PERFECT, thank you so much for that you are a lifesaver
:-)

Regards

Chris Payne

www.planetoxygene.com


 On sön, 03 feb 2002, Chris Payne wrote:

  Hi there everyone,
 
  I need to generate a random number between 1 and 15 for insertion into a
  DB, I can easily do the DB side of it but what is the best method for
  quickly generating a random number between 1 and 15 (including 1 and 15
  in the equation)?

 srand((double)microtime()*100);
 $randomnumber = rand(1,15);

 Something like this?

 --
 patrik_wallstrom-foodfight-[EMAIL PROTECTED]+46-709580442


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




Re: [PHP-DB] mass insert to database

2002-02-03 Thread Jason G.

See the set_time_limit() function in the php manual.

-Jason Garber
IonZoft.com


At 10:22 AM 2/4/2002 +0800, J-E-N wrote:
hello all,


i'm trying to make a script where i can do a mass insert to database 
(4,000 entries) and then send confirmation email to each of the entry's 
email address stating that their record has been inserted to database. My 
problem is, when i use a while loop the page time-out on the 300th entry. 
please help.

thanx


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