[PHP] Parsing a local file

2003-07-29 Thread Jason D. Williard
I am trying to build script that will parse a file on the user's computer.
There are 2 things that I am not quite sure about.

1) How to read a file on the user's computer, and not on the server.

2) How to parse a line similar to the one below:

7/29/2003 , Report Title , Page , Agent Name , 5200 , 30 ,
3:30 ,  ,  , 

Now, in this line, there are items that I would like to discard.  As well,
there are items between the s that I would like the parse further.  Below
is how I would like it parsed

$month/$day/$year , DISCARD , DISCARD , DISCARD , $agentid ,
$calls_taken , $avg_call_time , DISCARD , DISCARD , DISCARD


Any help would be appreciated.

Thanks,
Jason







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



[PHP] Parsing a local file

2003-07-29 Thread Jason D. Williard
I am trying to build script that will parse a file on the user's computer.
There are 2 things that I am not quite sure about.

1) How to read a file on the user's computer, and not on the server.

2) How to parse a line similar to the one below:

7/29/2003 , Report Title , Page , Agent Name , 5200 , 30 ,
3:30 ,  ,  , 

Now, in this line, there are items that I would like to discard.  As well,
there are items between the s that I would like the parse further.  Below
is how I would like it parsed

$month/$day/$year , DISCARD , DISCARD , DISCARD , $agentid ,
$calls_taken , $avg_call_time , DISCARD , DISCARD , DISCARD


Any help would be appreciated.

Thanks,
Jason





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



[PHP] Calendar

2003-03-01 Thread Jason D. Williard
Is there an easy way to create a calendar in PHP, such as a calendar
function?  All I need is a dynamically created calendar to link to other
pages.

Jason D. Williard




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



[PHP] RE: Incrementing the value

2002-10-04 Thread Jason D

It's not very clear what you want but the following could be it:

?if(!isset($_GET['hid']))
{$h=1;}
else
{$h=$_GET['hid'];}?

a href=Delay.php?hid=?php echo $h+1; ?
img src=Gif/nextque.gif border=0/a




 i have written code such that initially it will display the value 
 correspond to the value 1..after every click it will increment the value 
 2,3...so on..but now it is displaying the value 1 and for after each click 
 again it is displaying 1 and 2...so on

 I have intiallised the value for the variable as 

 if(!$_GET['hid'])
 $hid=1;

 like that..Can anyone please tell me how to avoid displaying the value 1 
 again..??





Watch a championship game with Elway or McGwire.
Enter Now at http://champions.lycos.com 

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




RE: [PHP] counting number of records in a MySQL table; how do I get

2002-10-03 Thread Jason D

An alternative way is to add a primary or unique key and make the code 
snippet like this:

mysql_query(INSERT ignore into AuthNum (FirstNum, LastNum, NextNum, KeyField) VALUES 
(1,2,3,1),$dblink);
mysql_query(Update AuthNum Set FirstNum = 1, LastNum = 2, NextNum = 3,$dbLink);

If there is a record already the insert won't work because it will have the same 
value in the key field. The update query is unchanged and there is no counting of
records.

I get the impression it's just a 1-record table.

 I need to do either an insert or update into a MySQL table.  Insert if there
 are 0 records or update if one record exist:

 This is my code snippet:

 if (mysql_query(SELECT COUNT(*) FROM AuthNum) == 0) {
mysql_query(INSERT into AuthNum (FirstNum, LastNum, NextNum) VALUES
 (1,2,3),$dblink);
 } else {
mysql_query(Update AuthNum Set FirstNum = 1, LastNum = 2, NextNum =
 3,$dbLink);
 }

 My problem is, a record never gets inserted because the SELECT COUNT query
 is returning a resource ID of 2.  How can I get the actual number of records
 in the table?



Tired of all the SPAM in your inbox? Switch to LYCOS MAIL PLUS
http://www.mail.lycos.com/brandPage.shtml?pageId=plus

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




Re: [PHP] reg exp matching/replacing

2002-10-03 Thread Jason D

Jen,

Don't use eregi_replace when str_replace will do.

$contents = str_replace($matches[0][$i], $blah, $contents);

Also the dots should be escaped or gif and jpg without 
dots before them will be matched.

preg_match_all('{\/*[A-z0-9_/-]+(\.gif|\.jpg)}', $contents, $matches);



Tired of all the SPAM in your inbox? Switch to LYCOS MAIL PLUS
http://www.mail.lycos.com/brandPage.shtml?pageId=plus

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




[PHP] Parsing Text File

2002-06-15 Thread Jason D. Williard

I am trying to input data from a text file into a MySQL database and would
like to be able to input the data using a single script.  What's the easiest
way to parse a line, such as below, and turn it into variables to be placed
in the database.  While I can simply place the data in by importing from a
file, it's not quite so easy.  I only need to place some of the data in,
plus I would like to split one of the fields.  Below is an example of a line
from the file, and then the variables that I need to enter.

Here is an example of a line from the file:
Number,City,State,Country,Provider,Isdn,56K,CreateDate,Active,Timezone,ModDa
te,ModNote
403 -770 -4904 ,CALGARY,AB,CAN,T2,Y,Y,Apr 29 2002
12:00:00:000AM,I,GMT-0700,,

As for variables, I need the following:
Split Number into $AreaCode  $Number  403  770-4904
$City
$State
$Country

Thanks for any help.

Jason D. Williard





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




[PHP] IMAP

2002-03-14 Thread Jason D. Williard

I would like to begin working with mail servers in PHP, with the intent of
creating a webmail system for my site.  I am trying to get things working,
but am not exactly sure how to get everything installed and configured
correctly.  I know that I have to install a c-client library, but am not
sure how to do this.  Not meaning to sound too helpless, could someone give
me some assistance installing and configuring the c-client?

 -- Jason W.



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