Re: [PHP-DB]problem in creating the ibm_db2 extension

2008-05-01 Thread H Thirividi
On Thu, May 1, 2008 at 5:53 AM, Chris [EMAIL PROTECTED] wrote:

 H Thirividi wrote:
  Hi All,
 
  I have installed db2 on my* fedora core 7* system and now i wan t to
 access
  the database using the* php apis*. For this reason I downloaded the
 *ibm_db2
  1.6* package and tried to create the extension. I did the following
 
  phpize
 
  output is
  Configuring for:
  PHP Api Version: 20041225
  Zend Module Api No:  20060613
  Zend Extension Api No:   220060519
 
  ./configure --with-IBM_DB2=/opt/ibm/db2/V9.5
  part of the ouput
 
  checking for re2c... no
  configure: WARNING: You will need re2c 0.12.0 or later if you want to
  regenerate PHP parsers.
  checking for gawk... gawk
  checking for IBM_DB2 support... yes, shared
  checking Looking for DB2 CLI libraries... checking  in
  /opt/ibm/db2/V9.5...
  checking  in /opt/ibm/db2/V9.5/lib64...
  checking  in /opt/ibm/db2/V9.5/lib32... found
  checking for DB2 CLI include files in default path... checking in
  /opt/ibm/db2/V9.5... not found

 It's looking for the include/, lib/ etc folders under that (ie the
 headers and so on).

 Where are they located?

 Hello Chris,

I am not sure if after getting a reply to the question one should still
reply to the mailing list or reply to the *person directly*. If I have
committed a mistake kindly oblige as this is new to me.
After posting the question I just *searched* and then came to know that
while installing db2, it had created 3 users named *db2inst1*,
*db2fenc1*and one more
*administrative user* whose name i am not able to recollect and then saw *db2
cli include files* in *db2inst1's home* when i logged onto the system as a
db2inst1 user and tried to copy those files to /opt/ibm/db2/V9.5 (which is
where db2 database is installed)  but  gave me an error saying that I cannot
copy.
I also changed the permissions and even then could not copy.
So does this mean i have to complie the extension by logging in as db2inst1
and cant this be as root or what should I do to continue further.

With Regards,
Harsha


Re: [PHP-DB]problem in creating the ibm_db2 extension

2008-05-01 Thread Chris
H Thirividi wrote:
 
 
 On Thu, May 1, 2008 at 5:53 AM, Chris [EMAIL PROTECTED]
 mailto:[EMAIL PROTECTED] wrote:
 
 H Thirividi wrote:
  Hi All,
 
  I have installed db2 on my* fedora core 7* system and now i wan t
 to access
  the database using the* php apis*. For this reason I downloaded
 the *ibm_db2
  1.6* package and tried to create the extension. I did the following
 
  phpize
 
  output is
  Configuring for:
  PHP Api Version: 20041225
  Zend Module Api No:  20060613
  Zend Extension Api No:   220060519
 
  ./configure --with-IBM_DB2=/opt/ibm/db2/V9.5
  part of the ouput
 
  checking for re2c... no
  configure: WARNING: You will need re2c 0.12.0 or later if you want to
  regenerate PHP parsers.
  checking for gawk... gawk
  checking for IBM_DB2 support... yes, shared
  checking Looking for DB2 CLI libraries... checking  in
  /opt/ibm/db2/V9.5...
  checking  in /opt/ibm/db2/V9.5/lib64...
  checking  in /opt/ibm/db2/V9.5/lib32... found
  checking for DB2 CLI include files in default path... checking in
  /opt/ibm/db2/V9.5... not found
 
 It's looking for the include/, lib/ etc folders under that (ie the
 headers and so on).
 
 Where are they located?
 
 Hello Chris,
 
 I am not sure if after getting a reply to the question one should still
 reply to the mailing list or reply to the *person directly*. If I have
 committed a mistake kindly oblige as this is new to me.

mailing list - so others can chime in with suggestions and/or learn from
the questions/comments.

 After posting the question I just *searched* and then came to know that
 while installing db2, it had created 3 users named *db2inst1*,
 *db2fenc1* and one more *administrative user* whose name i am not able
 to recollect and then saw *db2 cli include files* in *db2inst1's home*
 when i logged onto the system as a db2inst1 user and tried to copy those
 files to /opt/ibm/db2/V9.5 (which is where db2 database is installed) 
 but  gave me an error saying that I cannot copy.

Note - I have never installed db2 so not sure how it works/is set up.

However, with mysql, postgresql, gd  other extensions for php, you have
to install the devel or dev package along with the main one for php
to compile against.

The dev package provides the headers which other packages can use, for
example:

/usr/include/postgresql/*.h
/usr/lib/postgresql/*

PHP looks at those headers (*.h) and uses those to work out functionality.

So when you compile, you have to point php to the base folder which
contains the include/ and lib/ subdirectories.

./configure --with-pgsql=/usr

in your case:

./configure --with-db2=/path/to/db2

under /path/to/db2 you need the include/, lib/ etc folders which include
the program headers. Without those files, php won't compile with db2
support.


It looks like you have the lib stuff there (lib32/ is fine, it was
picked up) but there's no include/ stuff which is what configure is
complaining about.

-- 
Postgresql  php tutorials
http://www.designmagick.com/

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



[PHP-DB] Re: [PHP] Best practices for using MySQL index

2008-05-01 Thread Shelley
On Wed, Apr 30, 2008 at 7:03 PM, Aschwin Wesselius [EMAIL PROTECTED]
wrote:

  Shelley wrote:

  Don't index just all integer fields. Keep track of the cardinality of a
 column. If you expect a field to have 100.000 records, but with only 500
 distinct values it has no use to put an index on that column. A full record
 search is quicker.


 Hmmm... That's new. :)



 Well, to give you a good measure: keep the cardinality between 30 to 70-80
 percent of your total records in a column. But sometimes your field is NULL
 or empty, so it really depends. You can't just put it into a standard
 configuration. And it also really depends on how many records a table
 contains etc.

 Besides that, benchmarking your development environment (you do have one
 do you?) can gives you a good idea on how your hardware and setup performs.

I think I missed that part. For I am concerning query, index, and entity
design most of the time.



 Aschwin Wesselius




-- 
Regards,
Shelley


Re: [PHP-DB] Timestamps

2008-05-01 Thread Jason Pruim


On Apr 30, 2008, at 5:03 PM, Philip Thompson wrote:


On Apr 30, 2008, at 10:54 AM, Jason Pruim wrote:

Hi Yves,

Thanks for the tip, that worked, I think I'll use that from now on..

Just out of curiosity though, any idea why it wasn't working as I  
was writing it :)


Did you try putting the query that PHP is generating in phpMyAdmin  
or MySQL Query Browser? See if it throws an error when attempting to  
update. It *appears* that the query should work.


No I haven't, I don't have phpMyAdmin installed since I do it all from  
the command line, and I don't pay for hosting yet... But I am going to  
need to change that. I don't believe I have heard about MySQL Query  
Browser though... Is it a webapp? Or do I need to install it on my  
local computer?






~Philip

PS... Was it you, Jason, or someone else who asked about the  
security of the community knowing their database structure and I  
encouraged the use of `backticks` around all field and table names?


Yeah it was me... Old habits die hard :) I'm working on converting  
everything :)





On Apr 30, 2008, at 11:47 AM, YVES SUCAET wrote:


Hi Jason,

It's not because you create a date/time value that you  
automatically have an
integer-value. You need to specify first that you want the date/ 
time value

converted to an integer value first.

See
http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_unix-timestamp
for an example of how to do this.

Actually, by using this function, you probably don't even need to  
create the
$modifiedTimestamp variable anymore. You can just write your SQL  
query as

follows:

$sql = Update `mytable` set timestamp=UNIX_TIMESTAMP() where  
Record='1';


HTH,

Yves

-- Original Message --
Received: Wed, 30 Apr 2008 10:39:11 AM CDT
From: Jason Pruim [EMAIL PROTECTED]
To: Stut [EMAIL PROTECTED]Cc: php-db@lists.php.net
Subject: Re: [PHP-DB] Timestamps


On Apr 30, 2008, at 11:35 AM, Stut wrote:


On 30 Apr 2008, at 16:29, Jason Pruim wrote:

Okay... So I know this should be simple...

Trying to store a timestamp in a MySQL database... The timestamp I
am making like so: $modifiedTimestamp = time();

and then just $sql = Update `mytable` set
timestamp='$modifiedTimestamp' where Record='1';

Simple right? Not quite...in my database it's storing a 0 in the
timestamp field which is a int(10) field.

I have googled, and searched manuals, but have not been able to
figure out what is going on

Any Ideas?


timestamp is a reserved word. Try putting it in backticks.



Okay, so I did a really crappy job at my sudo code... The field name
is actually Last_Updated.

so my update code looks like this: Last_Updated='$modifiedTimestamp'

*Slaps his wrist... Bad copy/paste! BAD!!!


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




--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424-9337
www.raoset.com
[EMAIL PROTECTED]




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



Re: [PHP-DB] Timestamps

2008-05-01 Thread Philip Thompson

On May 1, 2008, at 7:56 AM, Jason Pruim wrote:


On Apr 30, 2008, at 5:03 PM, Philip Thompson wrote:


On Apr 30, 2008, at 10:54 AM, Jason Pruim wrote:

Hi Yves,

Thanks for the tip, that worked, I think I'll use that from now on..

Just out of curiosity though, any idea why it wasn't working as I  
was writing it :)


Did you try putting the query that PHP is generating in phpMyAdmin  
or MySQL Query Browser? See if it throws an error when attempting  
to update. It *appears* that the query should work.


No I haven't, I don't have phpMyAdmin installed since I do it all  
from the command line, and I don't pay for hosting yet... But I am  
going to need to change that. I don't believe I have heard about  
MySQL Query Browser though... Is it a webapp? Or do I need to  
install it on my local computer?


Query Browser is part of the MySQL GUI tools. You can download them  
here and use on your local computer:


http://dev.mysql.com/downloads/gui-tools/5.0.html

However, if you're using command line, then that should provide the  
same error messages (if any) that may assist you.




~Philip

PS... Was it you, Jason, or someone else who asked about the  
security of the community knowing their database structure and I  
encouraged the use of `backticks` around all field and table names?


Yeah it was me... Old habits die hard :) I'm working on converting  
everything :)





On Apr 30, 2008, at 11:47 AM, YVES SUCAET wrote:


Hi Jason,

It's not because you create a date/time value that you  
automatically have an
integer-value. You need to specify first that you want the date/ 
time value

converted to an integer value first.

See
http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_unix-timestamp
for an example of how to do this.

Actually, by using this function, you probably don't even need to  
create the
$modifiedTimestamp variable anymore. You can just write your SQL  
query as

follows:

$sql = Update `mytable` set timestamp=UNIX_TIMESTAMP() where  
Record='1';


HTH,

Yves

-- Original Message --
Received: Wed, 30 Apr 2008 10:39:11 AM CDT
From: Jason Pruim [EMAIL PROTECTED]
To: Stut [EMAIL PROTECTED]Cc: php-db@lists.php.net
Subject: Re: [PHP-DB] Timestamps


On Apr 30, 2008, at 11:35 AM, Stut wrote:


On 30 Apr 2008, at 16:29, Jason Pruim wrote:

Okay... So I know this should be simple...

Trying to store a timestamp in a MySQL database... The  
timestamp I

am making like so: $modifiedTimestamp = time();

and then just $sql = Update `mytable` set
timestamp='$modifiedTimestamp' where Record='1';

Simple right? Not quite...in my database it's storing a 0 in  
the

timestamp field which is a int(10) field.

I have googled, and searched manuals, but have not been able to
figure out what is going on

Any Ideas?


timestamp is a reserved word. Try putting it in backticks.



Okay, so I did a really crappy job at my sudo code... The field  
name

is actually Last_Updated.

so my update code looks like this:  
Last_Updated='$modifiedTimestamp'


*Slaps his wrist... Bad copy/paste! BAD!!!


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



[PHP-DB] Alternative for MySQL Admin tools

2008-05-01 Thread Yves Sucaet
Just like to point out http://www.sqlyog.com, an alternative stand-alone 
desktop tool to manage you MySQL servers. The free community edition is very 
good! I've been using it for 3 years now and never had to need to install 
anything else or additional.

HTH,

Yves


Re: [PHP-DB] Alternative for MySQL Admin tools

2008-05-01 Thread Ken Keefe
Unfortunately it is windows only (written with .NET). When I was stuck
on a windows box, it was a very nice tool. I'd use it now if it
existed on other platforms...

Ken


On Thu, May 1, 2008 at 9:30 AM, Yves Sucaet [EMAIL PROTECTED] wrote:
 Just like to point out http://www.sqlyog.com, an alternative stand-alone 
 desktop tool to manage you MySQL servers. The free community edition is very 
 good! I've been using it for 3 years now and never had to need to install 
 anything else or additional.

  HTH,

  Yves


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



[PHP-DB] How to do a Newsletter

2008-05-01 Thread Nasreen Laghari
Hi,
Does any one know a better way of doing Newsletter. I have to run a query and 
send that data to clients. 
Regards


  

Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ

Re: [PHP-DB] How to do a Newsletter

2008-05-01 Thread Jason Pruim
That's not an awful lot to go off of.. I'm assuming the actual  
newsletter is already produced probably in a PDF?


Are you looking to e-mail it out?

Post it to a website?

Get e-mail addresses to e-mail it to?

Get postal addresses to postal mail it to?

More info I think would definitely help.


On May 1, 2008, at 11:59 AM, Nasreen Laghari wrote:


Hi,
Does any one know a better way of doing Newsletter. I have to run  
a query and send that data to clients.

Regards


  


Be a better friend, newshound, and
know-it-all with Yahoo! Mobile.  Try it now.  
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ


--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424-9337
www.raoset.com
[EMAIL PROTECTED]




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



Re: [PHP-DB] How to do a Newsletter

2008-05-01 Thread Nasreen Laghari
I have to email it. Basically I have run a query according to user criteria of 
newsletter and send it via email


- Original Message 
From: Jason Pruim [EMAIL PROTECTED]
To: Nasreen Laghari [EMAIL PROTECTED]
Cc: php-db@lists.php.net
Sent: Thursday, May 1, 2008 5:03:43 PM
Subject: Re: [PHP-DB] How to do a Newsletter

That's not an awful lot to go off of.. I'm assuming the actual  
newsletter is already produced probably in a PDF?

Are you looking to e-mail it out?

Post it to a website?

Get e-mail addresses to e-mail it to?

Get postal addresses to postal mail it to?

More info I think would definitely help.


On May 1, 2008, at 11:59 AM, Nasreen Laghari wrote:

 Hi,
 Does any one know a better way of doing Newsletter. I have to run  
 a query and send that data to clients.
 Regards


      
 
 Be a better friend, newshound, and
 know-it-all with Yahoo! Mobile.  Try it now.  
 http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ

--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424-9337
www.raoset.com
[EMAIL PROTECTED]




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


  

Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ

Re: [PHP-DB] How to do a Newsletter

2008-05-01 Thread Jason Pruim
Without seeing any of your code to base it off of I'd select it like  
this:


$sql = SELECT `email`, `emailNewsletter` FROM `mytable` where  
`emailNewsletter`='YES';


then just loop through the array that gets returned...

while ($row = mysqli_fetch_assoc($result)) {
//build the e-mail


}

Obviously, there's more to it, but that should get you started. If you  
run into trouble, post code that we could look at and see if we can  
help you.




On May 1, 2008, at 12:17 PM, Nasreen Laghari wrote:

I have to email it. Basically I have run a query according to user  
criteria of newsletter and send it via email



- Original Message 
From: Jason Pruim [EMAIL PROTECTED]
To: Nasreen Laghari [EMAIL PROTECTED]
Cc: php-db@lists.php.net
Sent: Thursday, May 1, 2008 5:03:43 PM
Subject: Re: [PHP-DB] How to do a Newsletter

That's not an awful lot to go off of.. I'm assuming the actual
newsletter is already produced probably in a PDF?

Are you looking to e-mail it out?

Post it to a website?

Get e-mail addresses to e-mail it to?

Get postal addresses to postal mail it to?

More info I think would definitely help.


On May 1, 2008, at 11:59 AM, Nasreen Laghari wrote:


Hi,
Does any one know a better way of doing Newsletter. I have to run
a query and send that data to clients.
Regards




Be a better friend, newshound, and
know-it-all with Yahoo! Mobile.  Try it now.  
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ


--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424-9337
www.raoset.com
[EMAIL PROTECTED]




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


  


Be a better friend, newshound, and
know-it-all with Yahoo! Mobile.  Try it now.  
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ


--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424-9337
www.raoset.com
[EMAIL PROTECTED]




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



RE: [PHP-DB] How to do a Newsletter

2008-05-01 Thread STEVEN CRUZ

Hello;

What exactly do you mean? I have some jobs in cron that run a query and then 
spit out an thml page via email. That type of thing?





From: Nasreen Laghari [EMAIL PROTECTED]
To: php-db@lists.php.net
Subject: [PHP-DB] How to do a Newsletter
Date: Thu, 1 May 2008 08:59:33 -0700 (PDT)

Hi,
Does any one know a better way of doing Newsletter. I have to run a query 
and send that data to clients.

Regards


  


Be a better friend, newshound, and
know-it-all with Yahoo! Mobile.  Try it now.  
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ




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



Re: [PHP-DB] Timestamps

2008-05-01 Thread Chris

 PS... Was it you, Jason, or someone else who asked about the security
 of the community knowing their database structure and I encouraged the
 use of `backticks` around all field and table names?
 
 Yeah it was me... Old habits die hard :) I'm working on converting
 everything :)

A little caveat with that:

1) it's mysql specific
2) I can disable you using backticks

http://www.php.net/manual/en/language.operators.execution.php

-- 
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP-DB] Timestamps

2008-05-01 Thread Chris
Chris wrote:
 PS... Was it you, Jason, or someone else who asked about the security
 of the community knowing their database structure and I encouraged the
 use of `backticks` around all field and table names?
 Yeah it was me... Old habits die hard :) I'm working on converting
 everything :)
 
 A little caveat with that:
 
 1) it's mysql specific
 2) I can disable you using backticks
 
 http://www.php.net/manual/en/language.operators.execution.php

Actually it doesn't, because the backtick is in a string.

Sorry for the noise..

-- 
Postgresql  php tutorials
http://www.designmagick.com/

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