[PHP-DB] help wanted for install php with mysql support on windows

2005-04-23 Thread zheng
I use Apache1.3,php5.0(they work fine) and mysql 4.1(it also can work 
separately) . But when I interact with MySql using php,it says  Fatal 
error: Call to undefined function mysql_connect() , I have uncommented 
php_mysql.dll inside php.ini and add D:\php to the system variable path, the 
libmysql.dll is in that path. Is there anything I should do to cope with 
this problem? Thank you very much!

-Zheng 

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



[PHP-DB] SQL or array ?

2005-04-23 Thread Paul Reilly

I have a quick question about which would the best way to implement
something in terms of performance. Using a database, or just creating
a big array in memory?

I have a PHP file manager script which creates an array of all
files in a directory, and get's their mime types. It then prints
these files to the browser with a little image or a word icon etc
for word documents.

So the data looks a bit like this:

+--++---+--+
| id   | mime_type  | description   | icon |
+--++---+--+
|0 | text/html  | HTML document | html.png |
|1 | application/msword | Word document | word.png |
+--++---+--+

But this means for every file it comes across it needs
to do an SQL query to find the description and icon name.
Which doesn't seem very efficient.

Would it be better to just create a big array at the start
of my script with all this data in? That would seem more
efficient, and hence faster way of doing it?

Any feedback appreciated.

Paul

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



Re: [PHP-DB] SQL or array ?

2005-04-23 Thread Mark Cain
explain the phrase big array.

What is big to you might not be big to the server nor to me but then again
maybe it's bigger.  Are you talking dozens, hundreds, thousands, millions??

- Original Message -
From: Paul Reilly [EMAIL PROTECTED]
To: php-db@lists.php.net
Sent: Saturday, April 23, 2005 5:05 PM
Subject: [PHP-DB] SQL or array ?



 I have a quick question about which would the best way to implement
 something in terms of performance. Using a database, or just creating
 a big array in memory?


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



Re: [PHP-DB] SQL or array ?

2005-04-23 Thread Paul Reilly

 explain the phrase big array.

I guess everything is relative!
We're talking about 300-500 items here.

Paul

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



[PHP-DB] postgresql and php

2005-04-23 Thread Tate
I have php and postgresql installed on my laptop with linux fedora core 
3.  Everything is working fine, but I have created a survey and want the 
entries automatically inserted into the database.

I know what my SQL should be, but I'm not sure if my other coding is 
correct.

In my form, I have radio buttons.
Any and all help is appreciated.
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] SQL or array ?

2005-04-23 Thread M Saleh EG
Only? That aint too big, but now i'm confused what's ur hardware and
O.Sspecs? 300 to 500 would be a peice of cake to load. However, it
depends on
ur system.

I would rather use the array than hitting the db for the query. Because the 
bottom line is that you will receive your data in an array no matter what 
even if its in the db so doesnt realy matter unless you wanna paginate it. 
In that case I'd use the db rather to array alone. 

Wow Hold on. That's a catch 22. If ur loading ur array in the beginning of 
the execution then just do it on the DB once n just load it the next time. 
That means the next time you dont have to take a trip to ur file system n 
then another trip to display the array. And plus if u needed to paginate 
which of corse ull need to for such a number db helps, however paginating 
arrays is easy as well.

HTH

Benchmark it! And find out for yourself.

On 4/24/05, Paul Reilly [EMAIL PROTECTED] wrote:
 
 
  explain the phrase big array.
 
 I guess everything is relative!
 We're talking about 300-500 items here.
 
 Paul
 
 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 


-- 
M.Saleh.E.G
97150-4779817


[PHP-DB] Re: SQL or array ?

2005-04-23 Thread Frank M Flynn
Paul,
Interesting - I don't know which would give better performance, there 
are too many things I don't know about your set up but here are some 
general rules I think would apply:

How many files are we talking about?  If it's many I think a database 
is the only way to go.

What happens when you shutdown the app (or it crashes)?  If the  data 
is in  a DB you should  have no problems (yes DB's do get corrupted and 
you do need to back them up but there are easy tools for this).  If 
everything is in a big array it's gone so you have to write code to 
store this  array  and  to retrieve it upon startup.

The Array is cached so it's fast...  But in fact so is your data in the 
database after you select it so it  could be fast too.

You say:
But this means for every file it comes across it needs
to do an SQL query to find the description and icon name.
Which doesn't seem very efficient.
I'm not sure this  is true - can you select information on several 
files in the  same query?  A single row select is not all that bad (not 
as good as hashing an array but it's not  a huge hit).  Turn on query 
caching and it won't even have to run the query again.

Will you have a DB there  anyway?  Do you need one for something else?  
If so then it's not much more work to use the DB for this too.

You can (if  you find  it useful) make  virtual directories where the 
files are arranged on the  disk as suites you but  are presented to the 
 user as if  they are in a special directory (which may not  exist).  
This can be useful if your application moves files around - say from an 
inbox to a read folder then to a delete folder.  If you do this all in 
PHP reading  the filesystem you have to move the actual file; if you do 
this  in a database you can leave the  file alone  and only update the 
record.

You can  also store more information about the files in the  database 
(comments, history, access levels, ...) this  could be  useful later - 
if it turns out you have to have a new field and your using  the  PHP 
only method you could have a pain implementing it.

If you needed to scale beyond 1 machine the DB solution could track 
files on several different  machines by adding  an additional column 
(for the  host of that  file) but the  PHP only solution would have 
trouble offering  a complete solution (it would see the  files on it's 
machine but not on the others).

Personally I'd use  the  DB but I  know SQL pretty well and I think I 
would always have a DB available.

Good Luck, feel free to ask more specific questions.
Frank
On Apr 23, 2005, at 2:07 PM, [EMAIL PROTECTED] wrote:
From: Paul Reilly [EMAIL PROTECTED]
Date: April 23, 2005 2:05:44 PM PDT
To: php-db@lists.php.net
Subject: SQL or array ?

I have a quick question about which would the best way to implement
something in terms of performance. Using a database, or just creating
a big array in memory?
I have a PHP file manager script which creates an array of all
files in a directory, and get's their mime types. It then prints
these files to the browser with a little image or a word icon etc
for word documents.
So the data looks a bit like this:
+--++---+--+
| id   | mime_type  | description   | icon |
+--++---+--+
|0 | text/html  | HTML document | html.png |
|1 | application/msword | Word document | word.png |
+--++---+--+
But this means for every file it comes across it needs
to do an SQL query to find the description and icon name.
Which doesn't seem very efficient.
Would it be better to just create a big array at the start
of my script with all this data in? That would seem more
efficient, and hence faster way of doing it?
Any feedback appreciated.
Paul