[PHP-DB] Date functions

2002-07-01 Thread Achilleas Maroulis

Hi. 
I want to know what is the right way to make some comparisons with date variables.
I have used only the date() function to get a variable in this format= 01-07-2002
Is there a way to add 20 days in order to have 21-07-2002 or 2 months to have 
01-09-2002?

Thanx in advance...



Re: [PHP-DB] Date functions

2002-07-01 Thread [EMAIL PROTECTED]

On Mon, 1 Jul 2002, Achilleas Maroulis wrote:

 Hi.
 I want to know what is the right way to make some comparisons with date variables.
 I have used only the date() function to get a variable in this format= 01-07-2002
 Is there a way to add 20 days in order to have 21-07-2002 or 2 months to have 
01-09-2002?

Hi!

Try to read PHP documentation:

http://www.php.net/manual/en/function.mktime.php

Regards
Urosh


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




[PHP-DB] Unified DB Query function

2002-07-01 Thread Casey Allen Shobe

I'm trying to write a unified database query function for an application I 
have which currently accesses data from both DB2 and Microsoft SQL from a 
Linux server.  I'm using ODBC functions for DB2, and Sybase functions for 
Microsoft SQL.

Here's what I've got for DB2, and a blank area for MSSQL:

function db_query ($db_type, $db_conn, $db_query) {
// Uncomment to debug
//echo $db_query.'br';
if ($db_type == 'odbc') {
$result = odbc_exec($db_conn, $db_query);
while(odbc_fetch_into($result, $row)) {
$data[0][]=$row;
}
$data[0] = get_data ($result);
$data[1] = odbc_num_rows ($result);
odbc_free_result ($result);
} else if ($db_type == 'sybase') {
// What do I put here?
}
return $data;
}

If anyone could tell me what I could put in the sybase if statement to return 
data in an identical format as that returned by the odbc if statement, I 
would greatly appreciate it!

I'm somewhat at a loss as the sybase commands are quite different from the 
odbc commands.

Thanks in advance,

-- 
Casey Allen Shobe / Network Security Analyst  PHP Developer
SecureWorks, Inc. / 404.327.6339 x169 / Fax: 404.728.0144
[EMAIL PROTECTED] / http://www.secureworks.net
Content is my own and does not necessarily represent my company.

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




[PHP-DB] PHP dBase date query

2002-07-01 Thread Ralf Kleinicke

Hi,

is there somebody around to tell me how to structure a query to select a
time period from a dBase table using dBase date fields?

I don't know how to convert a date string in PHP so dBase can interpretate
it.

In clipper for instance one may use date-to-string dtos() or string-to-date
stod()

Query should look like this:

$qry = select * from TABLE where date = ?

Ralf



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




Re: [PHP-DB] Re: Excel to MySQL??

2002-07-01 Thread Christian Rellstab

use LOAD DATA (plus parameters) to import excel-files and other 
text-files into mysql

chris


Am Sonntag den, 30. Juni 2002, um 01:23, schrieb Manuel Lemos:

 [EMAIL PROTECTED]


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




Re: [PHP-DB] Re: Excel to MySQL??

2002-07-01 Thread Christian Rellstab

i forgot: LOAD DATA is a mysql-command

http://www.mysql.com/doc/L/o/Loading_tables.html

chris


Am Montag den, 1. Juli 2002, um 14:16, schrieb Christian Rellstab:

 use LOAD DATA (plus parameters) to import excel-files and other 
 text-files into mysql

 chris


 Am Sonntag den, 30. Juni 2002, um 01:23, schrieb Manuel Lemos:

 [EMAIL PROTECTED]


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

2002-07-01 Thread Martin Clifford

Nice, mature response, Jason.  Really smooth! :o)

:chortle:

Martin

 [EMAIL PROTECTED] 06/30/02 09:44AM 
On Sunday 30 June 2002 09:06, CrossWalkCentral wrote:

As this has nothing to do with DBs it should be posted to the php-general 
list.

 When using this fucntion listed bellow with the HTML headder

What function? And what HTML header?

 the email sent does not show the FROM in the FORM filed it just displays it
 in the email message

FORM filed -- is this FROM field or FORM filled (or do you really mean FORM 
filed?)

 Any one have any ideas.

From this confusing mish-mash, I can only guess that you're trying to use the 
mail() function and you're trying to add a FROM header.

 $headers .= From: CrossWalkCentral [EMAIL PROTECTED] \n;

That being the case the manual has an example on how it is done.

-- 
Jason Wong - Gremlins Associates - www.gremlins.com.hk 
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *


/*
No good deed goes unpunished.
-- Clare Booth Luce
*/


-- 
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] Unified DB Query function

2002-07-01 Thread Casey Allen Shobe

I figured it out.  Here's my completed code for reference:

$db2_conn = @odbc_connect (DB2_ALIAS, DB2_USERNAME, DB2_PASSWORD) or
$db_error .= 'font size=+2bUnable to connect to DB2 
Database!!/b/fontbr'.\n.'bfont color=#ccError Message: 
/font/b'.$php_errormsg.'br';

$piv_conn = @sybase_connect (PIV_ALIAS, PIV_USERNAME, PIV_PASSWORD) or
$db_error .= 'font size=+2bUnable to connect to Pivotal 
Database!!/b/fontbr'.\n.'bfont color=#ccError Message: 
/font/b'.$php_errormsg.'br';
if (!isset($db_error)) {
sybase_select_db ('Enterprise_Data', $piv_conn);
}

function db_query ($db_type, $db_query) {
if ($db_type == 'db2') {
global $db2_conn;
$result = odbc_exec ($db2_conn, $db_query);
while (odbc_fetch_into ($result, $row)) {
$data[0][] = $row;
}
$data[1] = odbc_num_rows ($result);
odbc_free_result ($result);
} else if ($db_type == 'piv') {
global $piv_conn;
$result = sybase_query ('set textsize 32768'.\n.$db_query, 
$piv_conn);
// What do I put here?
while ($row = sybase_fetch_array ($result)) {
$data[0][] = $row;
}
$data[1] = sybase_num_rows ($result);
}
return $data;
}

-- 
Casey Allen Shobe / Network Security Analyst  PHP Developer
SecureWorks, Inc. / 404.327.6339 x169 / Fax: 404.728.0144
[EMAIL PROTECTED] / http://www.secureworks.net
Content is my own and does not necessarily represent my company.



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




FW: [PHP-DB] blob versus file

2002-07-01 Thread Ryan Jameson (USA)

I agree, it's definitely simpler and quicker to just store them in the file system and 
save the file path in the database.

 Ryan

-Original Message-
From: Pierre-Alain Joye [mailto:[EMAIL PROTECTED]]
Sent: Monday, July 01, 2002 6:21 AM
To: andy
Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re: [PHP-DB] blob versus file


On Mon, 1 Jul 2002 14:17:53 +0200
andy [EMAIL PROTECTED] wrote:

 Hi there,
 
 I am wondering if anybody has experiance in saving images to blob in mysql.
 
 I do save images with 1 K and 4 KB to blob fields while I used to save them
 to file. It seams to me that this is much slower accessing the files. The
 images take a bit (really short but absolutly noticable) to show up on the
 site. Is there a way to improve the performance, and why is this happening?
 I thought the performance might even boost after storing them to blobs.

Not really, the OS filesystem contains features that makes it always faster than a sql 
query, that will increase your network traffic too.

Inserting images or whatever binary data in a database does not have much sense, you 
could not do a query with this field, cannot be indexed (dunno if exists a DB that 
implement a image indexer ;) ). Storing relative pathes gave me always more 
portabilities between DBM.

In some case, you have to insert images (or every others binary data) in DB (due to 
global permissions system only avaible for the DB and not for the filesystem, for 
example), but as far is possible, I avoid to do it so.

IMHO :)

pa

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


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




[PHP-DB] Re: Unified DB Query function

2002-07-01 Thread Manuel Lemos

Hello,

On 07/01/2002 06:46 AM, Casey Allen Shobe wrote:
 I'm trying to write a unified database query function for an application I 
 have which currently accesses data from both DB2 and Microsoft SQL from a 
 Linux server.  I'm using ODBC functions for DB2, and Sybase functions for 
 Microsoft SQL.

Why do you re-invent the wheeel and don't you use a database abstraction 
package that handles the database differences of you, like for instance 
Metabase:

http://www.phpclasses.org/metabase

-- 

Regards,
Manuel Lemos


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




Re: [PHP-DB] Re: Unified DB Query function

2002-07-01 Thread Pierre-Alain Joye

On Mon, 01 Jul 2002 14:55:01 -0300
Manuel Lemos [EMAIL PROTECTED] wrote:

 Hello,
 
 On 07/01/2002 06:46 AM, Casey Allen Shobe wrote:
  I'm trying to write a unified database query function for an application I 
  have which currently accesses data from both DB2 and Microsoft SQL from a 
  Linux server.  I'm using ODBC functions for DB2, and Sybase functions for 
  Microsoft SQL.
 
 Why do you re-invent the wheeel and don't you use a database abstraction 
 package that handles the database differences of you, like for instance 
 Metabase:
 
 http://www.phpclasses.org/metabase
Just because diversity rules in our world :).

btw, do you have samples codes using the xDefinition methods in metabase ?


pa

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




Re: [PHP-DB] Re: Unified DB Query function

2002-07-01 Thread Manuel Lemos

Hello,

On 07/01/2002 03:01 PM, Pierre-Alain Joye wrote:
I'm trying to write a unified database query function for an application I 
have which currently accesses data from both DB2 and Microsoft SQL from a 
Linux server.  I'm using ODBC functions for DB2, and Sybase functions for 
Microsoft SQL.

Why do you re-invent the wheeel and don't you use a database abstraction 
package that handles the database differences of you, like for instance 
Metabase:

http://www.phpclasses.org/metabase
 
 Just because diversity rules in our world :).
 
 btw, do you have samples codes using the xDefinition methods in metabase ?

What do you mean by xDefinition methods?


-- 

Regards,
Manuel Lemos


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




Re: [PHP-DB] Re: Unified DB Query function

2002-07-01 Thread Casey Allen Shobe

On Monday 01 July 2002 01:55 pm, Manuel Lemos wrote:
 Why do you re-invent the wheeel and don't you use a database abstraction
 package that handles the database differences of you, like for instance
 Metabase.

Because I had never heard of it.  It doesn't appear to have a sybase module 
anyways, and they appear to be separate classes for each database, whereas I 
wanted one for all.  Perhaps however I am misreading the site, but it won't 
let me very far without a username and password.

-- 
Casey Allen Shobe / Network Security Analyst  PHP Developer
SecureWorks, Inc. / 404.327.6339 x169 / Fax: 404.728.0144
[EMAIL PROTECTED] / http://www.secureworks.net
Content is my own and does not necessarily represent my company.

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




RE: [PHP-DB] Re: Unified DB Query function

2002-07-01 Thread Cal Evans

Casy,

try php.weblogs.com ADODB.  It is a database abstraction layer that supports
Sybase. (Among other db backends.)

HTH,
=C=

*
* Cal Evans
* Journeyman Programmer
* Techno-Mage
* http://www.calevans.com
*


-Original Message-
From: Casey Allen Shobe [mailto:[EMAIL PROTECTED]]
Sent: Monday, July 01, 2002 3:04 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Re: Unified DB Query function


On Monday 01 July 2002 01:55 pm, Manuel Lemos wrote:
 Why do you re-invent the wheeel and don't you use a database abstraction
 package that handles the database differences of you, like for instance
 Metabase.

Because I had never heard of it.  It doesn't appear to have a sybase module
anyways, and they appear to be separate classes for each database, whereas I
wanted one for all.  Perhaps however I am misreading the site, but it won't
let me very far without a username and password.

--
Casey Allen Shobe / Network Security Analyst  PHP Developer
SecureWorks, Inc. / 404.327.6339 x169 / Fax: 404.728.0144
[EMAIL PROTECTED] / http://www.secureworks.net
Content is my own and does not necessarily represent my company.

--
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] blob versus file

2002-07-01 Thread andy

Hi there,

I am wondering if anybody has experiance in saving images to blob in mysql.

I do save images with 1 K and 4 KB to blob fields while I used to save them
to file. It seams to me that this is much slower accessing the files. The
images take a bit (really short but absolutly noticable) to show up on the
site. Is there a way to improve the performance, and why is this happening?
I thought the performance might even boost after storing them to blobs.

Thank you for any comments on that,

Andy

PS: I was planing to store all the other images (20 - 50 KB) to blobs as
well (thousands) but after this first experiance I am a bit confused if the
performance would even more suffer. Would you guys recommend this?



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




Re: [PHP-DB] blob versus file

2002-07-01 Thread Pierre-Alain Joye

On Mon, 1 Jul 2002 14:17:53 +0200
andy [EMAIL PROTECTED] wrote:

 Hi there,
 
 I am wondering if anybody has experiance in saving images to blob in mysql.
 
 I do save images with 1 K and 4 KB to blob fields while I used to save them
 to file. It seams to me that this is much slower accessing the files. The
 images take a bit (really short but absolutly noticable) to show up on the
 site. Is there a way to improve the performance, and why is this happening?
 I thought the performance might even boost after storing them to blobs.

Not really, the OS filesystem contains features that makes it always faster than a sql 
query, that will increase your network traffic too.

Inserting images or whatever binary data in a database does not have much sense, you 
could not do a query with this field, cannot be indexed (dunno if exists a DB that 
implement a image indexer ;) ). Storing relative pathes gave me always more 
portabilities between DBM.

In some case, you have to insert images (or every others binary data) in DB (due to 
global permissions system only avaible for the DB and not for the filesystem, for 
example), but as far is possible, I avoid to do it so.

IMHO :)

pa

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




Re: [PHP-DB] Re: Unified DB Query function

2002-07-01 Thread Manuel Lemos

Hello,

On 07/01/2002 05:03 PM, Casey Allen Shobe wrote:
 On Monday 01 July 2002 01:55 pm, Manuel Lemos wrote:
 
Why do you re-invent the wheeel and don't you use a database abstraction
package that handles the database differences of you, like for instance
Metabase.
 
 
 Because I had never heard of it.  It doesn't appear to have a sybase module 

Now you heard of it.

There is a Sybase driver here awaiting to go through the driver 
conformance tests that verify if Metabase API features work as expected 
with this driver. You know, rigorous quality control so nobody gets 
surprises.

http://groups.yahoo.com/group/metabase-dev/files/beta/


 anyways, and they appear to be separate classes for each database, whereas I 

Actually separate classes for each database is a good idea because you 
only call each function fo one database at a time, so it is not bloated 
as it would be if there was a single class with code for all databases.


 wanted one for all.  Perhaps however I am misreading the site, but it won't 
 let me very far without a username and password.

You just need to subscribe to the site, it is free.

-- 

Regards,
Manuel Lemos


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




[PHP-DB] Linked tables and fields in a form

2002-07-01 Thread Peter Goggin

I have two related tables. The first has about 12 records, each of which is
related to about 12 records in the second table.  I want to have two
interconnectedt dropdown list fields. The fist is used to select from the
first table and when the value has been selected, use it to determine the
contents of the second drop down list.

Obviously I can do this by having interrelated pages where the value from
the first fiels is carried to the second page and used to populate the
second drop down list.

Is there any way of doing this so within a single page?


Regards


Peter Goggin


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




[PHP-DB] delete multiple records with one query

2002-07-01 Thread Matt Nigh

hi, i'm trying to delete multiple records at once from a mysql db and can't
seem to figure out how to do so.
here's the code i've been trying to troubleshoot with:

$result_insert = mysql_query(delete from $mysql_table where id = '8' AND
where id = '18');


i've tried various things such as taking away the single quotes, replacing
AND with a comma, etc.
after i figure out how to delete multiple records, i need to figure out how
to go about carrying data from checkboxes and finding a query to delete the
records that were checked on the previous page:

ex.
input type=checkbox name=id value=1
input type=checkbox name=id value=2
input type=checkbox name=id value=3
etc.


any help would be appreciated.

thanks very much,


Matt



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




Re: [PHP-DB] delete multiple records with one query

2002-07-01 Thread Paul DuBois

At 22:37 -0400 7/1/02, Matt Nigh wrote:
hi, i'm trying to delete multiple records at once from a mysql db and can't
seem to figure out how to do so.
here's the code i've been trying to troubleshoot with:

$result_insert = mysql_query(delete from $mysql_table where id = '8' AND
where id = '18');

I assume that this never deletes any records, since no record can
have an id column whose value is 8 and 18 at the same time? :--)

Don't you mean OR?



i've tried various things such as taking away the single quotes, replacing
AND with a comma, etc.
after i figure out how to delete multiple records, i need to figure out how
to go about carrying data from checkboxes and finding a query to delete the
records that were checked on the previous page:

ex.
input type=checkbox name=id value=1
input type=checkbox name=id value=2
input type=checkbox name=id value=3
etc.


any help would be appreciated.

thanks very much,


Matt



--
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] delete multiple records with one query

2002-07-01 Thread Tony

If you want to delete multiple items, you need to use array name condition
in checkbox.
Here's an example:

form action = delete.php method = post
input type = checkbox name = name_array[] value = value1
input type = checkbox name = name_array[] value = value2

!-- more and more... --

input type = submit name = name value = GO
/form

Of course you can use a while loop to output the form.
Then in your PHP code that processes this form, you need to run a query for
every one of the data you want to delete:

if (count($_POST[name_array])  0)
{
foreach($_POST[name_array] as $name_element)
{
// call a function to delete record
}
else
{
// print message because no checkbox has been selected
exit;
}

Tony S. Wu 


Matt Nigh at [EMAIL PROTECTED] wrote:

 hi, i'm trying to delete multiple records at once from a mysql db and can't
 seem to figure out how to do so.
 here's the code i've been trying to troubleshoot with:
 
 $result_insert = mysql_query(delete from $mysql_table where id = '8' AND
 where id = '18');
 
 
 i've tried various things such as taking away the single quotes, replacing
 AND with a comma, etc.
 after i figure out how to delete multiple records, i need to figure out how
 to go about carrying data from checkboxes and finding a query to delete the
 records that were checked on the previous page:
 
 ex.
 input type=checkbox name=id value=1
 input type=checkbox name=id value=2
 input type=checkbox name=id value=3
 etc.
 
 
 any help would be appreciated.
 
 thanks very much,
 
 
 Matt
 
 




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




Re: [PHP-DB] blob versus file

2002-07-01 Thread Andy

is the increase of the network traffic noticable? The query is pretty small
just text. Do u really think this might increase the traffic?

I also noticed that the image is not cached anymore. Is this true for all
blobs, or do I just access them in a wron way?
(I am requesting a php file in the img tag with the statement inside and
output them before sending a jpeg header with an echo)

Thanx for your help,

Andy


Pierre-Alain Joye [EMAIL PROTECTED] schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 On Mon, 1 Jul 2002 14:17:53 +0200
 andy [EMAIL PROTECTED] wrote:

  Hi there,
 
  I am wondering if anybody has experiance in saving images to blob in
mysql.
 
  I do save images with 1 K and 4 KB to blob fields while I used to save
them
  to file. It seams to me that this is much slower accessing the files.
The
  images take a bit (really short but absolutly noticable) to show up on
the
  site. Is there a way to improve the performance, and why is this
happening?
  I thought the performance might even boost after storing them to blobs.

 Not really, the OS filesystem contains features that makes it always
faster than a sql query, that will increase your network traffic too.

 Inserting images or whatever binary data in a database does not have much
sense, you could not do a query with this field, cannot be indexed (dunno if
exists a DB that implement a image indexer ;) ). Storing relative pathes
gave me always more portabilities between DBM.

 In some case, you have to insert images (or every others binary data) in
DB (due to global permissions system only avaible for the DB and not for the
filesystem, for example), but as far is possible, I avoid to do it so.

 IMHO :)

 pa



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