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



[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



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



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



[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

html
head
Inventory Lookup
  meta name=GENERATOR content=W3e 2000
  title/title
/head
body

?php

$partnum=;
function get_partnum($partnum=) {
?
FORM ACTION=default.php METHOD=get

 PartNum:INPUT TYPE=TEXT NAME=partnum
 INPUT TYPE=submit VALUE=submit
/FORM


?php
}

$dsn=invfile;
$user= ;
$upasswd= ;

get_partnum();
#$partnum= $_get['partnum'];
echo $partnum;
$conn = odbc_connect($dsn,$user ,$upasswd, SQL_CUR_USE_ODBC ); echo
conn: $conn; if ($conn = 0) { echo Error in connectionBR; exit; }
else { echo PConnection successful\n; }; $query = SELECT
whs,loc,miprod,mndesc,onhand FROM npshrlib_prdinv1 where miprod =
'$partnum' ; $result = odbc_exec($conn, $query);
odbc_result_all($result);


?
/body
/html



-- 
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
 



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