Re: [PHP-DB] Splitting a CSV file

2003-11-24 Thread Matt Babineau
Chris,

If you are on a Redhat machine, you could try running a CLI command on
this.

Try looking up the 'split' command, it may solve your problem if you
combine it with some PHP.

-Matt

On Mon, 2003-11-24 at 19:14, Chris Payne wrote:
> Hi there everyone,
> 
> I'm writing an automation system to automatically insert data into a mysql database 
> from a CSV file, and it works great - until I try to insert a large file, then it 
> just doesn't do anything.
> 
> I've set my PHP filesize to 10 Megs so that's not the issue, and a server timeout 
> isn't the issue either.  So, is that a way that I can split a CSV file into 2 files 
> if it's larger than a certain size so that I can still use the automation I am 
> working on?
> 
> Actually, I won't see the files as it's for a company who just wants to be able to 
> select their CSV file (No matter what size) and it will insert it automatically, and 
> as I said it does work on small files but not large :-(
> 
> Any help would really be appreciated.
> 
> Chris

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



[PHP-DB] Need some MySQL Optimization suggestions - uber slow queries

2003-09-26 Thread Matt Babineau
I have a page that when all said and done is super slow. The queries are
running a bunch of JOINs and SORTs and WHEREs. I recently implemented
the my-large.cnf file in hopes it would help out the situation, but the
change appears negligible.

Does anyone have any suggestions for speeding up the query process...a
lot?

Thanks, Matt

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



Re: [PHP-DB] Need to Run a PHP script using CRON or ?

2003-09-15 Thread Matt Babineau
Goto your shell and type "php -i" w/o the quotes. You should see the
phpinfo() output. You can pass the path to your script as a command line
variable, and it will process it. Here, read about it, I think this is
the right answer for you: http://us3.php.net/features.commandline

Matt

On Mon, 2003-09-15 at 15:41, Jonathan Villa wrote:
> I have an application which creates temporary tables.  My plan is to
> remove them after a 24 hour period and only those which are have a
> created time greater than 24 hours.  That part I can do, my question is
> how will I be able to run this script which is a 2 part script.
> 
> First thing I do is pull the names of the temporary tables which are
> going to be deleted from another table.  From this result set, I need to
> DROP tables as well as remove the reference to them from the first
> table.
> 
> I understand that I can run PHP from the command line but this would
> require PHP to installed as a CGI which I prefer not to do.
> 
> I was hoping I that I could use CRON to run this script once a day...
> 
> Any ideas?  

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



Re: [PHP-DB] changing datatypes in the query

2003-08-26 Thread Matt Babineau
I think I answered my own question, I used CAST() to set the type in the
ORDER BY statement.

cast(s11.data as unsigned)

Thx to me!
Matt

On Tue, 2003-08-26 at 11:21, Matt Babineau wrote:
> Hi all-
> 
> Tough question (I think). I am pulling some numbers out of a data base,
> currently they are stored in a blob. When I try to "order by user_hits
> desc" it does a text ordering, not a numerical ordering. Is there a way
> to get it to do a numeric ordering?
> 
> Thanks,
> Matt

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



[PHP-DB] changing datatypes in the query

2003-08-26 Thread Matt Babineau
Hi all-

Tough question (I think). I am pulling some numbers out of a data base,
currently they are stored in a blob. When I try to "order by user_hits
desc" it does a text ordering, not a numerical ordering. Is there a way
to get it to do a numeric ordering?

Thanks,
Matt

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



[PHP-DB] WHERE mydatestamp > '2003-08-22 13:13:13'

2003-08-22 Thread Matt Babineau
Hey All-

I'm trying to find things in my database that are greater then Now(),
but the date is stored in a blob (don't ask, I know :-0). Is there a way
I can do that comparison to find things that are in the future?

Thanks, Matt


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



[PHP-DB] storing serialized() data in the db -> can it be queried on?

2003-08-18 Thread Matt Babineau
Hi All-

I don't think that this is possible but maybe through some custom
function perhaps? I am storing data in a database, and it is an Array
(in PHP) so I serialized it for storage. I want to be able to query that
data and be able to do something like WHERE thisField = 'john'. the
field 'thisField' though would need to be pointing to the first element
in the Array, which I don't think is possible. Has anyone run into this
before?

Thanks,
Matt


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



Re: [PHP-DB] Pulling an ID list from a DB, then filteringthat list againstanother list of ID's

2003-08-14 Thread Matt Babineau
Ah ha! perfect! I wanted a way for SQL to handle this. DUH!

Thanks John.

-Matt

On Thu, 2003-08-14 at 17:20, John W. Holmes wrote:
> Matt Babineau wrote:
> > Here is what I have for a layout:
> > 
> > thing_id -> it is a hash value (md5())
> > 
> > I have a user session variable that is an array "thing_id's that were
> > viewed".
> > 
> > So each time the user click a like to view a thing_id, I note that in a
> > session variable, so when they go back to the home page, all the things
> > they have viewed are not shown, only the ones they have not viewed.
> > 
> > Thing_id
> > -
> > 1 | hash_id_1
> > 2 | hash_id_2
> > 3 | hash_id_3
> > 4 | hash_id_4
> > 
> > Viewed (Session Var)
> > 
> > 1 | hash_id_2
> > 2 | hash_id_4
> > 
> > 
> > So when the user hits the homepage, they should get a list of 2 hash
> > ID's hash_id_1 and hash_id_3. That is how I want this to work, I just
> > need a slick way to compare and filter the viewed hash_id's from the
> > complete list I am pulling form the DB.
> > 
> > Does that help?
> 
> Yes. You only need to maintain one list, actually, the list of "things" 
> that the user has viewed. Then, do something like this:
> 
> $list = "'" . implode("','",$_SESSION['viewed_hash']) . "'";
> $query = "SELECT thing FROM Thing_Table WHERE thing_hash NOT IN ($list)";
> 
> Run that query and you'll have all of the results in the table that the 
> view has not seen.
> 
> -- 
> ---John Holmes...
> 
> Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
> 
> PHP|Architect: A magazine for PHP Professionals – www.phparch.com
> 
> 
> 
> 


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



Re: [PHP-DB] Pulling an ID list from a DB, then filtering thatlist againstanother list of ID's

2003-08-14 Thread Matt Babineau
Here is what I have for a layout:

thing_id -> it is a hash value (md5())

I have a user session variable that is an array "thing_id's that were
viewed".

So each time the user click a like to view a thing_id, I note that in a
session variable, so when they go back to the home page, all the things
they have viewed are not shown, only the ones they have not viewed.

Thing_id
-
1 | hash_id_1
2 | hash_id_2
3 | hash_id_3
4 | hash_id_4

Viewed (Session Var)

1 | hash_id_2
2 | hash_id_4


So when the user hits the homepage, they should get a list of 2 hash
ID's hash_id_1 and hash_id_3. That is how I want this to work, I just
need a slick way to compare and filter the viewed hash_id's from the
complete list I am pulling form the DB.

Does that help?

Thanks,
Matt

On Thu, 2003-08-14 at 16:35, CPT John W. Holmes wrote:
> From: "Matt Babineau" <[EMAIL PROTECTED]>
> > Got an interesting problem! I have a list of ID's, basically  things
> > people have viewed on my website. When I pull the viewable items from my
> > database, I need to be able to filter out all the ID's people have
> > already viewed, so that they only get a list of things they have not
> > viewed.
> >
> > I can think of a way to do this, but it is a nasty loop situation, that
> > would probably not be good and tie up significant CPU time. Anyone have
> > any suggestions on ways to filter view items from a fresh list that I am
> > pulling from my Database?
> 
> So you have a "thing_id" and a "user_id". How do you mark the user as having
> viewed the "thing"?
> 
> I'm thinking a LEFT JOIN is in order here, but need some more info on your
> table structure.
> 
> ---John Holmes...
> 


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



[PHP-DB] Pulling an ID list from a DB, then filtering that list againstanother list of ID's

2003-08-14 Thread Matt Babineau
Hey All-

Got an interesting problem! I have a list of ID's, basically  things
people have viewed on my website. When I pull the viewable items from my
database, I need to be able to filter out all the ID's people have
already viewed, so that they only get a list of things they have not
viewed.

I can think of a way to do this, but it is a nasty loop situation, that
would probably not be good and tie up significant CPU time. Anyone have
any suggestions on ways to filter view items from a fresh list that I am
pulling from my Database?

RH9, PHP 4.3.2, MySQL 4.0.14-standard, Apache 2.0.47

Thanks!
Matt


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



[PHP-DB] Query Cache not Working? MySQL 4.0.14-standard

2003-08-14 Thread Matt Babineau
For some reason my MySQL doesn't seem to be caching queries!

Is there a manual config change that needs to be made or do I need to
rebuild mysql some special way? I couldn't find anythign in the docs
about this, but it would greatly help my PHP pages if it were caching
properly!

Thanks,

Matt


mysql> show variables like 'have_query%';
+--+---+
| Variable_name| Value |
+--+---+
| have_query_cache | YES   |
+--+---+
1 row in set (0.00 sec)



mysql> show status;
+--++
| Variable_name| Value  |
+--++
| Aborted_clients  | 18 |
| Aborted_connects | 0  |
| Bytes_received   | 40020  |
| Bytes_sent   | 102217 |
| Com_admin_commands   | 95 |
| Com_alter_table  | 0  |
| Com_analyze  | 0  |
| Com_backup_table | 0  |
| Com_begin| 0  |
| Com_change_db| 106|
| Com_change_master| 0  |
| Com_check| 0  |
| Com_commit   | 0  |
| Com_create_db| 0  |
| Com_create_function  | 0  |
| Com_create_index | 0  |
| Com_create_table | 0  |
| Com_delete   | 1  |
| Com_delete_multi | 0  |
| Com_drop_db  | 0  |
| Com_drop_function| 0  |
| Com_drop_index   | 0  |
| Com_drop_table   | 0  |
| Com_flush| 0  |
| Com_grant| 0  |
| Com_ha_close | 0  |
| Com_ha_open  | 0  |
| Com_ha_read  | 0  |
| Com_insert   | 16 |
| Com_insert_select| 0  |
| Com_kill | 0  |
| Com_load | 0  |
| Com_load_master_data | 0  |
| Com_load_master_table| 0  |
| Com_lock_tables  | 0  |
| Com_optimize | 0  |
| Com_purge| 0  |
| Com_rename_table | 0  |
| Com_repair   | 0  |
| Com_replace  | 0  |
| Com_replace_select   | 0  |
| Com_reset| 0  |
| Com_restore_table| 0  |
| Com_revoke   | 0  |
| Com_rollback | 0  |
| Com_savepoint| 0  |
| Com_select   | 191|
| Com_set_option   | 0  |
| Com_show_binlog_events   | 0  |
| Com_show_binlogs | 0  |
| Com_show_create  | 5  |
| Com_show_databases   | 2  |
| Com_show_fields  | 18 |
| Com_show_grants  | 0  |
| Com_show_keys| 15 |
| Com_show_logs| 0  |
| Com_show_master_status   | 0  |
| Com_show_new_master  | 0  |
| Com_show_open_tables | 0  |
| Com_show_processlist | 0  |
| Com_show_slave_hosts | 0  |
| Com_show_slave_status| 0  |
| Com_show_status  | 2  |
| Com_show_innodb_status   | 0  |
| Com_show_tables  | 4  |
| Com_show_variables   | 0  |
| Com_slave_start  | 0  |
| Com_slave_stop   | 0  |
| Com_truncate | 0  |
| Com_unlock_tables| 0  |
| Com_update   | 16 |
| Connections  | 17 |
| Created_tmp_disk_tables  | 43 |
| Created_tmp_tables   | 45 |
| Created_tmp_files| 0  |
| Delayed_insert_threads   | 0  |
| Delayed_writes   | 0  |
| Delayed_errors   | 0  |
| Flush_commands   | 1  |
| Handler_commit   | 0  |
| Handler_delete   | 1  |
| Handler_read_first   | 1  |
| Handler_read_key | 16374  |
| Handler_read_next| 356091 |
| Handler_read_prev| 0  |
| Handler_read_rnd | 561|
| Handler_read_rnd_next| 4280   |
| Handler_rollback | 0  |
| Handler_update   | 16 |
| Handler_write| 1848   |
| Key_blocks_used  | 73 |
| Key_read_requests| 53252  |
| Key_reads| 45 |
| Key_write_requests   | 322|
| Key_writes   | 42 |
| Max_used_connections | 9  |
| Not_flushed_key_blocks   | 0  |
| Not_flushed_delayed_rows | 0  |
| Open_tables  | 13 |
| Open_files   | 16 |
| Open_streams | 0  |
| Opened_tables| 19 |
| Questions| 379|
| Qcache_queries_in_cache  | 0  |
| Qcache_inserts   | 0  |
| Qcache_hits  | 0  |
| Qcache_lowmem_prunes | 0  |
| Qcache_not_cached| 0  |
| Qcache_free_memory   | 0  |
| Qcache_free_blocks   | 0  |
| Qcache_total_blocks  | 0  |
| Rpl_status   | NULL   |
| Select_full_join | 0  |
| Select_full_range_join   | 44 |
| Select_range   

[PHP-DB] M$ Access

2002-08-14 Thread Matt Babineau

Is there a way to connect to M$ Access with PHP without using something
like MyODBC? WIN2K, IIS5, PHP 4.2.2.
 
I know this must have been asked before but I am wondering...
 
 
Matt Babineau
MCWD / CCFD
-
e:  <mailto:[EMAIL PROTECTED]> [EMAIL PROTECTED]
p: 603.943.4237
w:  <http://www.criticalcode.com/> http://www.criticalcode.com
PO BOX 601
Manchester, NH 03105



[PHP-DB] copy a table

2002-07-15 Thread Matt Babineau

What was the SQL that could be run to copy a table, I want to make a
duplicate of a table, it just having a different name?
 
Matt Babineau
MCWD / CCFD
-
e:  <mailto:[EMAIL PROTECTED]> [EMAIL PROTECTED]
p: 603.943.4237
w:  <http://www.criticalcode.com/> http://www.criticalcode.com
PO BOX 601
Manchester, NH 03105
 



RE: [PHP-DB] help with $_Get in form

2002-06-21 Thread Matt Babineau

Just from quickly looking you are trying to submit a form and grab the
submitted value and stick it into the DB?

If so try using METHOD="POST" on your form, and using the variable
$_POST["form_field"] in the insert statement

Matt Babineau
MCWD / CCFD
-
e: [EMAIL PROTECTED]
p: 603.943.4237
w: http://www.criticalcode.com
PO BOX 601
Manchester, NH 03105


-Original Message-
From: Mike Germain [mailto:[EMAIL PROTECTED]] 
Sent: Friday, June 21, 2002 2:25 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] help with $_Get in form


I'm trying to get a partnum field into a select statement but i'm not
getting anything passed into the varable. i'm sure it's a simple fix but
i can't find it. thx mike



Inventory Lookup
  
  






 PartNum:
 



"; exit; }
else { echo "Connection successful\n"; }; $query = "SELECT
whs,loc,miprod,mndesc,onhand FROM npshrlib_prdinv1 where miprod =
'$partnum' "; $result = odbc_exec($conn, $query);
odbc_result_all($result);


?>





-- 
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] MySQL Clustering, redundancy

2002-06-18 Thread Matt Babineau

Thanks for your response Adam! 

Do you know if there is any way MySQL can be spread across multiple
machines? I am looking at a huge application for a client, that will
need to support thousands of simultaneous users. I am wondering if MySQL
can handle load like that. That's why I was asking about clustering
MySQL servers for the ability to handle more users simultaneously.

Has anyone had any experience with a large scale application on MySQL?

Matt Babineau
Freelance Internet Developer
-
e: [EMAIL PROTECTED]
p: 603.943.4237
w: http://www.criticalcode.com
PO BOX 601
Manchester, NH 03105


-Original Message-
From: Adam Voigt [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, June 18, 2002 8:55 AM
To: [EMAIL PROTECTED]
Cc: Matt Babineau
Subject: Re: [PHP-DB] MySQL Clustering, redundancy


Yes,it's called Replication in the MySQL documentation. However, since
the info in the manual is kind of sparse so I would hop on google and do
a search for specific instructions on how to do it when your ready, but
to answer your question, yes, MySQL does do Redundancy/Failover.
(Ofcourse you must take account of this in your code interacting with
the server, but the data will be sync'd).

Adam Voigt
[EMAIL PROTECTED]

On Tue, 2002-06-18 at 08:47, Matt Babineau wrote:
> Hi All:
>  
> I quickly skimmed the MySQL manual and didn't see any information on 
> clustering. Does MySQL have any support for clustering or some type of

> redundant failover systems?
>  
> Thanks!
>  
> Matt Babineau
> Freelance Internet Developer
> -
> e:  <mailto:[EMAIL PROTECTED]> [EMAIL PROTECTED]
> p: 603.943.4237
> w:  <http://www.criticalcode.com/> http://www.criticalcode.com PO BOX 
> 601 Manchester, NH 03105
>  



-- 
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] MySQL Clustering, redundancy

2002-06-18 Thread Matt Babineau

Hi All:
 
I quickly skimmed the MySQL manual and didn't see any information on
clustering. Does MySQL have any support for clustering or some type of
redundant failover systems?
 
Thanks!
 
Matt Babineau
Freelance Internet Developer
-
e:  <mailto:[EMAIL PROTECTED]> [EMAIL PROTECTED]
p: 603.943.4237
w:  <http://www.criticalcode.com/> http://www.criticalcode.com
PO BOX 601
Manchester, NH 03105