[PHP] Dynamic Tables

2004-06-07 Thread Christopher J. Crane
What is the best way to produce a report listing the fieldname and then the
data in that field. It is a report containing only one row from a table, but
I don't want to hard code the fields since they change often.

I can get the field names dynamically like this:

$fields = mysql_list_fields("Network", "Subnets");
$num_columns = mysql_num_fields($fields);
for($ i = 0; $i < $num_columns; $i++) { echo mysql_field_name($fields,
$i); }

now is where I get confusedwhat I would like to happen is do a query on
a single row and put the results into mysql_fetch_assoc and during the prior
loop put the column name into the loop of the data. Something like:

$fields = mysql_list_fields("Network", "Subnets");
$num_columns = mysql_num_fields($fields);
$result  =  mysql_query("SELECT * FROM table1 WHERE ID = '$ID';
$field = mysql_fetch_assoc($result)
for($ i = 0; $i < $num_columns; $i++) {
echo "" . mysql_field_name($fields, $i) . ": " .
$field[mysql_field_name($fields, $i)] . "\n";

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



Re: [PHP] Str_Replace Command

2004-02-02 Thread Christopher J. Crane
Well this is it and it is really got me...
Echoing out the $Symbol and $Price works just fine one row about the
$TickerData array assignment. Yet it outputs nothing.
"Array ( [] => )" is what I get. If I change the line to
$TickerData = array ("$Symbol" => "$Price"); I get nothing, or the same
result. If I change the line to
$TickerData = array ('$Symbo'l => '$Price'); I get the following
Array ( [$Symbol] => $Price ) which tells me the assignment works, but it
seems like the $Symbol and $Price variable are blank when assigning to the
array. I know that they are not blank since they echoed out just fine one
line above.



  $StockURL =
"http://finance.yahoo.com/d/quotes.txt?s=xrx,ikn,danky&f=sl1&e=.txt";;
  $StockResults = implode('', file("$StockURL"));
  $Rows = split("\n", $StockResults);
  foreach($Rows as $Row) {
list($Symbol, $Price) = split(",", $Row);
 $Symbol = str_replace('"', "", $Symbol);
echo $Symbol." - ".$Price."\n";
$TickerData = array ($Symbol => $Price);
}
  print_r($TickerData);



"Jason Wong" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> On Tuesday 03 February 2004 00:52, Christopher J. Crane wrote:
> > Ok I got around it by the following, but now I have a new problem. I can
> > not get the two dimensional array working. I want to later be able to
> > output a variable like this $TickerData["IKN"] and it will output the
> > associated $Price.
>
> >   print_r($TickerData);
>
> So what does the above show? If it isn't what you expect, figure out
*why*.
> Like how is $TickerData being assigned.
>
> -- 
> Jason Wong -> Gremlins Associates -> www.gremlins.biz
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
> --
> Search the list archives before you post
> http://marc.theaimsgroup.com/?l=php-general
> --
> /*
> We have phasers, I vote we blast 'em!
> -- Bailey, "The Corbomite Maneuver", stardate 1514.2
> */

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



Re: [PHP] Str_Replace Command

2004-02-02 Thread Christopher J. Crane
Ok I got around it by the following, but now I have a new problem. I can not
get the two dimensional array working. I want to later be able to output a
variable like this $TickerData["IKN"] and it will output the associated
$Price.

  $StockURL =
"http://finance.yahoo.com/d/quotes.txt?s=xrx,ikn,danky&f=sl1&e=.txt";;
  $StockResults = implode('', file("$StockURL"));
  $Rows = split("\n", $StockResults);
  foreach($Rows as $Row) {
list($Symbol, $Price) = split(",", $Row);
   $Symbol = str_replace('"', "", $Symbol);
   $TickerData = array("$Symbol"=>"$Ticker");
}
  print_r($TickerData);
  echo $TickerData["IKN"]."\n";




"Jason Wong" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> On Tuesday 03 February 2004 00:14, Christopher J. Crane wrote:
>
> >   $StockURL =
> > "http://finance.yahoo.com/d/quotes.txt?s=xrx,ikn,danky&f=sl1&e=.txt";;
> >   $StockResults = implode('', file("$StockURL"));
> >   $Rows = split("\n", $StockResults);
> >   foreach($Rows as $Row) { echo str_replace('"',"",$Row)."\n"; }
> >   foreach($Rows as $Row) { str_replace('"',"",$Row); echo
$Row."\n"; }
>
> str_replace() RETURNS the replaced string. It does not alter $Row.
>
> -- 
> Jason Wong -> Gremlins Associates -> www.gremlins.biz
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
> --
> Search the list archives before you post
> http://marc.theaimsgroup.com/?l=php-general
> --
> /*
> Spiritual leadership should remain spiritual leadership and the temporal
> power should not become too important in any church.
> - Eleanor Roosevelt
> */

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



[PHP] Str_Replace Command

2004-02-02 Thread Christopher J. Crane
I have never had this problem before and it is probably something simple...
Please take a look at the two foreach statements. I am at a loss as to why
the second line does not actually remove the quotes. The first foreach
statement does so how are they different.

  $StockURL =
"http://finance.yahoo.com/d/quotes.txt?s=xrx,ikn,danky&f=sl1&e=.txt";;
  $StockResults = implode('', file("$StockURL"));
  $Rows = split("\n", $StockResults);
  foreach($Rows as $Row) { echo str_replace('"',"",$Row)."\n"; }
  foreach($Rows as $Row) { str_replace('"',"",$Row); echo $Row."\n"; }

Eventually, I need to break apart the $Row into two elements $Symbol and
$Price and then into a two dimensional array. I have done this with the code
below, but so far, I can not get rid of the quotes.

  foreach($Rows as $Row){
list($Symbol, $Price) = split("\n", $Row);
$TickerData=array("$Symbol"=>"$Price");
}

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



Re: [PHP] Seems Simple enough

2004-01-26 Thread Christopher J. Crane
Ok the problem seems to me, the format. I think that once I have the format
changed to include a comma seperation for thousands. I think at that point,
it is no longer a true number, so PHP deals with it differently.
"Christopher J. Crane" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Good Question on the looking though all rows. I never wrote code looking
at
> just that one code and getting the variable from the column. That is why I
> limited the query to one "LIMIT 1". I guess it is just me pasting code
from
> my other applications and not checking it out.
>
> To the original problem, it all hinges on me changing the format of
> $Balance. If I remove the line  " $Balance =
> number_format($SummaryField["Balance"],2,'.',','); "
> and replace it with " $Balance = $SummaryField["Balance"]; " it works
fine.
>
> "Stuart" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > Christopher J. Crane wrote:
> > > This does not ...
> > >   $SummaryResults = mysql_query("SELECT * FROM Accounting WHERE
> > > UserID='$UserID' LIMIT 1") or die("Invalid query");
> > >   while($SummaryField = mysql_fetch_array($SummaryResults)) {
> > > $Balance = number_format($SummaryField["Balance"],2,'.',',');
> > > }
> >
> > Display $Balance here. Just do a print $Balance. Something is wrong
> > there, not below.
> >
> > While we're at it, why are you looping through all of the rows setting
> > $Balance each time? If it's only going to return one row, get that one
> > row and use it!!
> >
> > >  if($Balance >= 10001) { echo " > > color=\"green\">\$$Balance\n"; }
> > >  elseif($Balance <= ) { echo " > > color=\"red\">\$$Balance\n"; }
> > >  else { echo "\$$Balance\n"; }
> >
> > -- 
> > Stuart

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



Re: [PHP] Seems Simple enough

2004-01-26 Thread Christopher J. Crane
Good Question on the looking though all rows. I never wrote code looking at
just that one code and getting the variable from the column. That is why I
limited the query to one "LIMIT 1". I guess it is just me pasting code from
my other applications and not checking it out.

To the original problem, it all hinges on me changing the format of
$Balance. If I remove the line  " $Balance =
number_format($SummaryField["Balance"],2,'.',','); "
and replace it with " $Balance = $SummaryField["Balance"]; " it works fine.

"Stuart" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Christopher J. Crane wrote:
> > This does not ...
> >   $SummaryResults = mysql_query("SELECT * FROM Accounting WHERE
> > UserID='$UserID' LIMIT 1") or die("Invalid query");
> >   while($SummaryField = mysql_fetch_array($SummaryResults)) {
> > $Balance = number_format($SummaryField["Balance"],2,'.',',');
> > }
>
> Display $Balance here. Just do a print $Balance. Something is wrong
> there, not below.
>
> While we're at it, why are you looping through all of the rows setting
> $Balance each time? If it's only going to return one row, get that one
> row and use it!!
>
> >  if($Balance >= 10001) { echo " > color=\"green\">\$$Balance\n"; }
> >  elseif($Balance <= ) { echo " > color=\"red\">\$$Balance\n"; }
> >  else { echo "\$$Balance\n"; }
>
> -- 
> Stuart

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



Re: [PHP] Seems Simple enough

2004-01-26 Thread Christopher J. Crane
Ok here is the wierd thing.
I pasted more code, it seems to not work because of me changing the number
format.

This works ...
 if($Balance >= 10001) {
   $Balance = number_format($Balance,2,'.',',');
   echo "\$$Balance\n"; }
 if($Balance <= ) {
   $Balance = number_format($Balance,2,'.',',');
   echo "\$$Balance\n"; }
 else {
   $Balance = number_format($Balance,2,'.',',');
   echo "\$$Balance\n"; }

This does not ...
  $SummaryResults = mysql_query("SELECT * FROM Accounting WHERE
UserID='$UserID' LIMIT 1") or die("Invalid query");
  while($SummaryField = mysql_fetch_array($SummaryResults)) {
$Balance = number_format($SummaryField["Balance"],2,'.',',');
}
 if($Balance >= 10001) { echo "\$$Balance\n"; }
 elseif($Balance <= ) { echo "\$$Balance\n"; }
 else { echo "\$$Balance\n"; }

"Stuart" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Christopher J. Crane wrote:
> >  if($Balance >= 10001) { echo " > color=\"green\">\$$Balance\n"; }
> >  elseif($Balance <= ) { echo " > color=\"red\">\$$Balance\n"; }
> >  else { echo "\$$Balance\n"; }
>
> Works fine here. The elseif condition will be true if $Balance is
> undefined. Are you sure that variable exists and is actually set to 1?
>
> -- 
> Stuart

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



[PHP] Re: jgraph and php

2004-01-26 Thread Christopher J. Crane
I do a lot of this.
Go to http://designpile.net/stocks
I use a file called charts.php as the image file..so like
http://designpile.net/stocks/images/lchart.php?sym=IKN
This way you can pass varibles to the php code. As you might have guessed
this is not an image but instead a PHP code creating the image with jpgraph
and exporting directly to the browser.

"Annazaraah" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi All,
>
> How does one go about integrating jgraphs into a html page, so that I can
> have the tables containing the data on one side and the corresponding
graphs
> on the other?
>
> Any suggestions much appreciated!
> Anna

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



[PHP] Seems Simple enough

2004-01-26 Thread Christopher J. Crane
I have these lines of code, that I thought was simple enough, but it doesn't
work how I thought.
The Variable $Balance is set to 1 in the database, and I thought it
would be outputed as purple or the be found true of the "else" part of the
code. It comes out as red or the "elseif" part of the code.

 if($Balance >= 10001) { echo "\$$Balance\n"; }
 elseif($Balance <= ) { echo "\$$Balance\n"; }
 else { echo "\$$Balance\n"; }

I originally had it as follows, but that didn't work either.

 if($Balance > 1) { echo "\$$Balance\n"; }
 elseif($Balance < 1) { echo "\$$Balance\n"; }
 else { echo "\$$Balance\n"; }

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



Re: [PHP] Simple question I hope

2003-12-16 Thread Christopher J. Crane
That worked.
Thanks Robert.

"Robert Cummings" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> On Tue, 2003-12-16 at 15:02, Christopher J. Crane wrote:
> > I am using Pdf-Php to create pdf docs. I have a long text line that
wraps
> > automatically when outputted in the pdf. That is what it is suppose to
do,
> > however, it also outputs the new lines of the text in the source of the
php
> > file. That is not what I want. So I do a string replace for the "\n" and
> > replace it will "" or nothing and instead I get "  " or two spaces.
> >
> > Example:
> >  $Scope = "
> >$Report is a report summarizing all the locations within the
> > Northeast Region. It contains all known
> >   business lines including LDS, BDS, and BS. Below each location will be
> > listed with summary
> >   data relating to the location such as the full mailing address, phone
> > number, network information
> >   and information about the phone system.";
> > $Scope = str_replace("\n", "", $Scope);
> >
> > Here I have a newline in the first line after the word known. I don't
want
> > it to put the new line there. So I added the str_replace function, but I
get
> > a double space instead of a single space.
>
> try:
>
> $Scope = trim( ereg_replace( '[[:space:]]+', ' ', $Scope ) );
>
> Cheers,
> Rob.
> -- 
> ..
> | InterJinn Application Framework - http://www.interjinn.com |
> ::
> | An application and templating framework for PHP. Boasting  |
> | a powerful, scalable system for accessing system services  |
> | such as forms, properties, sessions, and caches. InterJinn |
> | also provides an extremely flexible architecture for   |
> | creating re-usable components quickly and easily.  |
> `'

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



[PHP] Simple question I hope

2003-12-16 Thread Christopher J. Crane
I am using Pdf-Php to create pdf docs. I have a long text line that wraps
automatically when outputted in the pdf. That is what it is suppose to do,
however, it also outputs the new lines of the text in the source of the php
file. That is not what I want. So I do a string replace for the "\n" and
replace it will "" or nothing and instead I get "  " or two spaces.

Example:
 $Scope = "
   $Report is a report summarizing all the locations within the
Northeast Region. It contains all known
  business lines including LDS, BDS, and BS. Below each location will be
listed with summary
  data relating to the location such as the full mailing address, phone
number, network information
  and information about the phone system.";
$Scope = str_replace("\n", "", $Scope);

Here I have a newline in the first line after the word known. I don't want
it to put the new line there. So I added the str_replace function, but I get
a double space instead of a single space.

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



Re: [PHP] SQL not returning entire field

2003-09-10 Thread Christopher J. Crane
I checked the field properties and it is set as large text or memo, and the
data is complete in the field, just when I try to fetch it, it comes back
truncated somehow.
"Christophe Chisogne" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Christopher J. Crane wrote:
> > returning only like some of the data in the field.
>
> > What I am getting back
>
> only 255 chars or so...
> Perhaps a varchar(255) field which should be something
> like "text" (MySQL) ?
>
> -- 
> Christophe

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



[PHP] SQL not returning entire field

2003-09-10 Thread Christopher J. Crane
Please Help!
I am using PHP to pull data from a MS SQL database. All other fields are
returning data fine, but this one table PROFILE is returning only like some
of the data in the field.

I am using the following simplified code:

MSSQL_CONNECT($HostName,$UserName,$Password);
mssql_select_db($DBName) or DIE("Table unavailable");

   $ProfileResults = MSSQL_QUERY("SELECT Profile FROM CompanyProfile WHERE
CompanyID = '3004'");
   $ProfileField = MSSQL_FETCH_ARRAY($ProfileResults);
   $Profile = wordwrap($ProfileField["Profile"]);
echo $Profile;
MSSQL_CLOSE();

Actual Field Data
"99 Services, Inc. is a full service IT systems integrator and general
contractor specializing in cradle to grave technology planning with strong
emphasis on LAN/WAN design (routing and switching) and deployment of high
speed, fully redundant, high availability networks. 99 Services also
provides Internet/Intranet/Website/email systems design.  The company
services small to medium sized businesses as well as home offices."

What I am getting back
"99 Services, Inc. is a full service IT systems integrator and general
contractor specializing in cradle to grave technology planning with strong
emphasis on LAN/WAN design (routing and switching) and deployment of high
speed, fully redundant, high availab"

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



[PHP] [HELP] - Session_Unregister Not working

2003-08-14 Thread Christopher J. Crane
I can not get a variable in a session to unset() and then re-populate and it
is destroyed. Please follow below to get the flow of what I am doing.


I have created a helpdesk application with a login. I am using sessions to
keep track of information I need for the session.
That information is
User's ID
User's Last Name
User's First Name
If the User is Authenticated
and the type user they are.

Here is the page the form goes to after submitting
-
");
 $Count = mysql_num_rows($UserResults);
 if($Count == 0) {  header("Location: error.php?ec=1"); exit; }

 // store the details in session variables
 session_start();
 session_register("SESSION");
 session_register("SESSION_FIRSTNAME");
 session_register("SESSION_LASTNAME");
 session_register("SESSION_AUTH");
 session_register("SESSION_USERID");
 session_register("SESSION_USERTYPE");

 // assign values to the session variables
 while ($Users = mysql_fetch_assoc($UserResults)) {
   $SESSION_FIRSTNAME = $Users["FirstName"];
   $SESSION_LASTNAME = $Users["LastName"];
   $SESSION_AUTH = "Yes";
   $SESSION_USERID = $Users["id"];
   $SESSION_USERTYPE = $Users["UserType"];
   }
 // update last login fields and redirect user to the tickets page
mysql_free_result($UserResults);
mysql_query("UPDATE users SET LastLoginDate = '$Now', LastLoginIP =
'$IP' WHERE id = '$SESSION_USERID'")
  or die("Authentication Database is temporarily offline. Try again
later.");
mysql_close();
 header("Location: tickets.php");
?>


When they logout they go to this page;
-


Here is the problem
on other pages I am displaying their usertype...

session_start();
if(!session_is_registered("SESSION")) { header("Location: error.php?ec=2");
exit; }
if($SESSION_AUTH != "Yes") { header("Location: error.php?ec=3"); exit; }

HTML 

HTML 

I have two users setup. One has a usertype of "Admin" and the other is
"User". If I login with the admin account, then logout and login with the
user account the variable $SESSION_USERTYPE is always "Admin". Even if I
change it in the database, it never changes. If I go into the database and
change the admin account to "User" it still says Admin. Some where it
appears that the unregister command and even the unset command is not
working. Can anyone tell me what is wrong and more importantly, tell me how
to fix it.




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



[PHP] Correct Coding

2003-08-14 Thread Christopher J. Crane
Is this the best way to do this?

if(isset($Task) && $Task == "Add") { Do something }

I want to check if the variable is set and if so, if it is "Add".




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



[PHP] Session Trouble

2003-08-14 Thread Christopher J. Crane
I have created a helpdesk application with a login. I am using sessions to
keep track of information I need for the session.
That information is
User's ID
User's Last Name
User's First Name
If the User is Authenticated
and the type user they are.

Here is the page the form goes to after submitting
-
");
 $Count = mysql_num_rows($UserResults);
 if($Count == 0) {  header("Location: error.php?ec=1"); exit; }

 // store the details in session variables
 session_start();
 session_register("SESSION");
 session_register("SESSION_FIRSTNAME");
 session_register("SESSION_LASTNAME");
 session_register("SESSION_AUTH");
 session_register("SESSION_USERID");
 session_register("SESSION_USERTYPE");

 // assign values to the session variables
 while ($Users = mysql_fetch_assoc($UserResults)) {
   $SESSION_FIRSTNAME = $Users["FirstName"];
   $SESSION_LASTNAME = $Users["LastName"];
   $SESSION_AUTH = "Yes";
   $SESSION_USERID = $Users["id"];
   $SESSION_USERTYPE = $Users["UserType"];
   }
 // update last login fields and redirect user to the tickets page
mysql_free_result($UserResults);
mysql_query("UPDATE users SET LastLoginDate = '$Now', LastLoginIP =
'$IP' WHERE id = '$SESSION_USERID'")
  or die("Authentication Database is temporarily offline. Try again
later.");
mysql_close();
 header("Location: tickets.php");
?>


When they logout they go to this page;
-


Here is the problem
on other pages I am displaying their usertype...

session_start();
if(!session_is_registered("SESSION")) { header("Location: error.php?ec=2");
exit; }
if($SESSION_AUTH != "Yes") { header("Location: error.php?ec=3"); exit; }

HTML 

HTML 

I have two users setup. One has a usertype of "Admin" and the other is
"User". If I login with the admin account, then logout and login with the
user account the variable $SESSION_USERTYPE is always "Admin". Even if I
change it in the database, it never changes. If I go into the database and
change the admin account to "User" it still says Admin. Some where it
appears that the unregister command and even the unset command is not
working. Can anyone tell me what is wrong and more importantly, tell me how
to fix it.



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



[PHP] Re: Increase a month

2003-03-20 Thread Christopher J. Crane
echo "\$month: ".date(F,strtotime($month))."";
you have escaped the $ by placing the \ in front of it. Remove it.
"Shaun" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi,
>
> could someone tell me why this:
>
> $month = date(m);
>echo "\$month: ".date(F,strtotime($month))."";
>$month = $month + 1;
>echo "\$month: ".date(F,strtotime($month))."";
> ?>
>
> outputs this:
>
> $month: March
> $month: March
>
> surely it should be:
>
> $month: March
> $month: April
>
> Thanks in advance for your help.
>
>



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



Re: [PHP] Re: Creating graphs with PHP?

2003-03-20 Thread Christopher J. Crane
If PHP is install the GD modules are already there.
Write a should script  and put it on your server and
access it through your web browser. It will tell you if GD is installed and
what version. I do a lot of work with these and would be willing to help you
get started.

By the way, most people here are using a shared hosting environment, myself
included.

"Denis L. Menezes" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Thanks guys for the help.
> I went to see JP graph. But what I cannot find out is how I can install
> jpgraph and GD libraries if I am hosting my site on a shared server with
an
> ISP(one of those USD 24.95 per month with 200Mb space kind of thing).
>
> Please help.
>
> Denis
>
> - Original Message -
> From: "Joseph Szobody" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Thursday, March 20, 2003 9:24 PM
> Subject: [PHP] Re: Creating graphs with PHP?
>
>
> > Dennis,
> >
> > Try this:
> >
> > http://www.aditus.nu/jpgraph/
> >
> > Joseph
> >
> > "Denis L. Menezes" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > hello friends,
> >
> > Is there a possibility to create graphs on a web page using PHP?
> >
> > I have loooked through the PHP manual but cannot find anything.
> >
> > Thanks very much.
> > Denis
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>



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



[PHP] Random Number Generation

2003-03-20 Thread Christopher J. Crane
I have a script that loads 13 or more file names into an array. Then at
random I select one of the names out of the array. This files are background
songs used on my webpage. Streaming a different song each time the page is
refreshed or loaded. My issue is I do not want the same song to ever be
played back to back. How can I check for that and if the random file chosen
is the currently played file then pick another..

Here is what I have so far.


How do I pass the variable to the next page easily so that PHP will know
what is currently being played?



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



[PHP] Re: Creating graphs with PHP?

2003-03-20 Thread Christopher J. Crane
JPGRAPH is the best I have found so far. Good documentation and great
results. I use it for a lot of graphing purposes, the most being stock
market charts and graphs.
"Joseph Szobody" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
Dennis,

Try this:

http://www.aditus.nu/jpgraph/

Joseph

"Denis L. Menezes" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
hello friends,

Is there a possibility to create graphs on a web page using PHP?

I have loooked through the PHP manual but cannot find anything.

Thanks very much.
Denis



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



[PHP] PDF Creation

2003-03-13 Thread Christopher J. Crane
I am just getting into PDF creation and I am having some issues. Can anyone
send me a simple script that creates a PDF doc. I would like it to open in
the browser after creation, not create a file. If someone has a simple one
with an image placement as well that would be great. I can figure it out if
I have a working one, but everything I tried so far does not work. Here is
the latest I tried and the error I get.

Warning: Wrong parameter count for pdf_close_image() in
/home/inxdesig/public_html/demos/pennytraders.com/pdf.php on line 20

Fatal error: PDFlib error: function 'PDF_stroke' must not be called in
'page' scope in /home/inxdesig/public_html/demos/pennytraders.com/pdf.php on
line 22






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



[PHP] Splitting a string

2003-03-13 Thread Christopher J. Crane
I have a CSV file that has 7 fields. One of the fields has a number, and
some of the numbers start with a "S". If that number start with a "S", I
want to strip it off. I am not sure how to do that. I first wrote the script
to open the file, load each line into an array and split the array by field.
Then split the variable where there is a "S". The problem showed up when
there is another "S" in the field. I only want to split the first "S" at the
beginning of the field. Isn't there an additional value to add to the split
function that will only split by the qualifier once.

Here is what I have now.




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



[PHP] Re: Checking for Null Variables

2003-03-07 Thread Christopher J. Crane
isset is the function I was looking for. I could not remember what it was.
Thank you.
"Bobby Patel" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> you can look at isset() and empty(). If you retrieve the query result with
> Mysql association (ie. $field=mysql_fetch_array($resource, MYSQL_ASSOC),
> then even the field has a blank value, there will be a blank variable
> created ($field["Name"] is created but with no value)), however if you
grab
> the resource values as such $field=mysql_fetch_array($resource), then a
> blank field will not create a $field["Name"].
>
> So, if using :
> $field=mysql_fetch_array($resource, MYSQL_ASSOC)
>  if(empty($field["Name"])) { do this }
>  else { do this }
>
> OR
> $field=mysql_fetch_array($resource)
>  if(!isset($field["Name"])) { do this }
>  else { do this }
>
>
>
> "Christopher J. Crane" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > How do I check if a variable is blank or not. I am returning data from a
> > MySQL database and if a field is empty I would like to do something
> > different.
> >
> > I tried
> > if($field["Name"] == "") { do this }
> > else { do this }
> >
> > It does not work right. Actually, at one point, it was working in the
> exact
> > opposite manner.
> >
> >
>
>



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



[PHP] Checking for Null Variables

2003-03-07 Thread Christopher J. Crane
How do I check if a variable is blank or not. I am returning data from a
MySQL database and if a field is empty I would like to do something
different.

I tried
if($field["Name"] == "") { do this }
else { do this }

It does not work right. Actually, at one point, it was working in the exact
opposite manner.



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



[PHP] getting data from a HTML table

2003-02-25 Thread Christopher J. Crane
I use a website to get data that I would like with the following code:

function StockLookup($company) {
 $LookupUrl = "http://quote.yahoo.com/l?s=$company";;
 $Results = implode('', file("$LookupUrl"));
 list($split1, $split2) = split('', $Results);
 list($Final, $split3) = split('',
$split2);
 print "$Final\n";
 }


The problem is that I get the HTML left after splitting up the page is in a
HTML table. The table has some columns and rows I do not want. What is the
easiest way to extract the data I want. The table contains 5 columns, but I
only want the first 4.



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



Re: [PHP] No Idea - Comparing Lines

2003-01-06 Thread Christopher J. Crane
Ok here is what I did but it does not do anything.
I verified that is opening the file ok and everything, but it shows nothing.
It doesn't even produce an error. I am sure there is an easier way than
looping twice, but this is how I have it for now.

$Lines = array();
$TempDir = "tempdata";
$DataFromFile = file("$TempDir/$Dat.txt");
while(list(,$oneline) = each($DataFromFile)) {
 array_push($Lines, $oneline);
 }
$LineCount = 1;
while(list(,$oneline) = each($DataFromFile)) {
  $PriorLineCount = $LineCount - 1;
  list($OctetsInB,$OctetsOutB,$TimeB) = split("|", $Lines[$LineCount]);
  list($OctetsInA,$OctetsOutA,$TimeA) = split("|", $Lines[$PriorLineCount]);
  // After much help and work with Harry, this is the formula we came up
with to show data rates over time.
  // (((Counter_Now - Counter_Before) / (Time_Now - Time_Before(converted to
seconds))) * 8)) / 1000 = kbits per hour
  $kbitsout = ((($OctetsOutB - $OctetsOutA) / ($TimeB - $TimeA)) * 8 ) /
1000;
  print "$kbitsout Kbits - $LineCount\n";
  $LineCount++;
 }

"Christopher J. Crane" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Thank you, I am going to try this now.
> "Petre Agenbag" <[EMAIL PROTECTED]> wrote in message
> 1041861992.1993.36.camel@DELL">news:1041861992.1993.36.camel@DELL...
> > When you read the first line, split the data into it's components , then
> > assign each value to a variable.
> > Call them:
> > $octet_1,$unix_time_1 etc.
> > Now, start the loop.
> > Inside the loop, read the next line, assign to $octet_2, $unix_time_2
> > etc.
> > Do your calculations ( $answer = $octet_2 - $octet_1 etc. )
> > Now, before exiting the loop:
> > $octet_1 = $octet_2;
> > $unix_time_1 = $unix_time_1;
> > etc
> >
> >
> > On Mon, 2003-01-06 at 15:51, Christopher J. Crane wrote:
> > > Ok, this is the first time I will post a message without a line of
code.
> I
> > > am not sure how to go about this task. So I will describe it and maybe
> > > someone will have some thoughts.
> > >
> > > I use PHP to connect to our many routers and get data using snmp. I
have
> > > written a script that refreshes itself every 10 secs. It writes the
data
> to
> > > a text file. The key element of this data is the Octet counters, or
the
> > > amount of data that has been transfered both in and out. To keep it
> simple,
> > > I will only talk about outs. In order to find the amount od data being
> > > transfered, I have to compare two lines. Then run a calculation on
that
> and
> > > then push that data into an array to plot on a chart later on.
> > >
> > > Here is an example of the file the data is written to:
> > > OctetsIn:4300492881|OctetsOut:4300544503|UnixTime:1041629017
> > > OctetsIn:4305184236|OctetsOut:4305234971|UnixTime:1041629031
> > > OctetsIn:4308716675|OctetsOut:4308782481|UnixTime:1041629044
> > > OctetsIn:4312595737|OctetsOut:4312685815|UnixTime:1041629058
> > > OctetsIn:4315910414|OctetsOut:4315961443|UnixTime:1041629072
> > > OctetsIn:4318948400|OctetsOut:4318975102|UnixTime:1041629085
> > > OctetsIn:4322040239|OctetsOut:4322091605|UnixTime:1041629098
> > > OctetsIn:4324981522|OctetsOut:4325033235|UnixTime:1041629111
> > > OctetsIn:4327971528|OctetsOut:4328029496|UnixTime:1041629125
> > > OctetsIn:4332318792|OctetsOut:4332379277|UnixTime:1041629138
> > > OctetsIn:4335594241|OctetsOut:4335635318|UnixTime:1041629153
> > > OctetsIn:4339008729|OctetsOut:4339048246|UnixTime:1041629166
> > > OctetsIn:4342539875|OctetsOut:4342591776|UnixTime:1041629180
> > > OctetsIn:4346070439|OctetsOut:4346127821|UnixTime:1041629193
> > > OctetsIn:4350288360|OctetsOut:4350355417|UnixTime:1041629206
> > >
> > > I can open the file and read the contents line by line
> > > split up but the delimiters and get the data I needbut this is
what
> has
> > > to happen.
> > > If PHP is on line 1, do nothing (it's needs two lines to compare
> against)
> > >
> > > If it's on line 2, then subtract Line 1, OctetsOut from Line Line 2
> > > OctetsOut. Then do the same with the UnixTime. Now run a calculation
on
> that
> > > data and push that into an array as the first data point. Now move on,
> with
> > > a loop I would assume, and do the same for lines 2 and 3, and so on,
> until
> > > we reach the end.
> > >
> > > There could be 5 lines or 500 lines.
> > >
> > > I can loop through the file and do everything, the biggest problem I
am
> > > having is getting the data on the line PHP is currently on, and then
> > > subtracting the line prior to it. I just can't seem to get a grasp on
> it.
> > >
> > >
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> >
>
>



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




Re: [PHP] No Idea - Comparing Lines

2003-01-06 Thread Christopher J. Crane
Thank you, I am going to try this now.
"Petre Agenbag" <[EMAIL PROTECTED]> wrote in message
1041861992.1993.36.camel@DELL">news:1041861992.1993.36.camel@DELL...
> When you read the first line, split the data into it's components , then
> assign each value to a variable.
> Call them:
> $octet_1,$unix_time_1 etc.
> Now, start the loop.
> Inside the loop, read the next line, assign to $octet_2, $unix_time_2
> etc.
> Do your calculations ( $answer = $octet_2 - $octet_1 etc. )
> Now, before exiting the loop:
> $octet_1 = $octet_2;
> $unix_time_1 = $unix_time_1;
> etc
>
>
> On Mon, 2003-01-06 at 15:51, Christopher J. Crane wrote:
> > Ok, this is the first time I will post a message without a line of code.
I
> > am not sure how to go about this task. So I will describe it and maybe
> > someone will have some thoughts.
> >
> > I use PHP to connect to our many routers and get data using snmp. I have
> > written a script that refreshes itself every 10 secs. It writes the data
to
> > a text file. The key element of this data is the Octet counters, or the
> > amount of data that has been transfered both in and out. To keep it
simple,
> > I will only talk about outs. In order to find the amount od data being
> > transfered, I have to compare two lines. Then run a calculation on that
and
> > then push that data into an array to plot on a chart later on.
> >
> > Here is an example of the file the data is written to:
> > OctetsIn:4300492881|OctetsOut:4300544503|UnixTime:1041629017
> > OctetsIn:4305184236|OctetsOut:4305234971|UnixTime:1041629031
> > OctetsIn:4308716675|OctetsOut:4308782481|UnixTime:1041629044
> > OctetsIn:4312595737|OctetsOut:4312685815|UnixTime:1041629058
> > OctetsIn:4315910414|OctetsOut:4315961443|UnixTime:1041629072
> > OctetsIn:4318948400|OctetsOut:4318975102|UnixTime:1041629085
> > OctetsIn:4322040239|OctetsOut:4322091605|UnixTime:1041629098
> > OctetsIn:4324981522|OctetsOut:4325033235|UnixTime:1041629111
> > OctetsIn:4327971528|OctetsOut:4328029496|UnixTime:1041629125
> > OctetsIn:4332318792|OctetsOut:4332379277|UnixTime:1041629138
> > OctetsIn:4335594241|OctetsOut:4335635318|UnixTime:1041629153
> > OctetsIn:4339008729|OctetsOut:4339048246|UnixTime:1041629166
> > OctetsIn:4342539875|OctetsOut:4342591776|UnixTime:1041629180
> > OctetsIn:4346070439|OctetsOut:4346127821|UnixTime:1041629193
> > OctetsIn:4350288360|OctetsOut:4350355417|UnixTime:1041629206
> >
> > I can open the file and read the contents line by line
> > split up but the delimiters and get the data I needbut this is what
has
> > to happen.
> > If PHP is on line 1, do nothing (it's needs two lines to compare
against)
> >
> > If it's on line 2, then subtract Line 1, OctetsOut from Line Line 2
> > OctetsOut. Then do the same with the UnixTime. Now run a calculation on
that
> > data and push that into an array as the first data point. Now move on,
with
> > a loop I would assume, and do the same for lines 2 and 3, and so on,
until
> > we reach the end.
> >
> > There could be 5 lines or 500 lines.
> >
> > I can loop through the file and do everything, the biggest problem I am
> > having is getting the data on the line PHP is currently on, and then
> > subtracting the line prior to it. I just can't seem to get a grasp on
it.
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>



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




[PHP] No Idea - Comparing Lines

2003-01-06 Thread Christopher J. Crane
Ok, this is the first time I will post a message without a line of code. I
am not sure how to go about this task. So I will describe it and maybe
someone will have some thoughts.

I use PHP to connect to our many routers and get data using snmp. I have
written a script that refreshes itself every 10 secs. It writes the data to
a text file. The key element of this data is the Octet counters, or the
amount of data that has been transfered both in and out. To keep it simple,
I will only talk about outs. In order to find the amount od data being
transfered, I have to compare two lines. Then run a calculation on that and
then push that data into an array to plot on a chart later on.

Here is an example of the file the data is written to:
OctetsIn:4300492881|OctetsOut:4300544503|UnixTime:1041629017
OctetsIn:4305184236|OctetsOut:4305234971|UnixTime:1041629031
OctetsIn:4308716675|OctetsOut:4308782481|UnixTime:1041629044
OctetsIn:4312595737|OctetsOut:4312685815|UnixTime:1041629058
OctetsIn:4315910414|OctetsOut:4315961443|UnixTime:1041629072
OctetsIn:4318948400|OctetsOut:4318975102|UnixTime:1041629085
OctetsIn:4322040239|OctetsOut:4322091605|UnixTime:1041629098
OctetsIn:4324981522|OctetsOut:4325033235|UnixTime:1041629111
OctetsIn:4327971528|OctetsOut:4328029496|UnixTime:1041629125
OctetsIn:4332318792|OctetsOut:4332379277|UnixTime:1041629138
OctetsIn:4335594241|OctetsOut:4335635318|UnixTime:1041629153
OctetsIn:4339008729|OctetsOut:4339048246|UnixTime:1041629166
OctetsIn:4342539875|OctetsOut:4342591776|UnixTime:1041629180
OctetsIn:4346070439|OctetsOut:4346127821|UnixTime:1041629193
OctetsIn:4350288360|OctetsOut:4350355417|UnixTime:1041629206

I can open the file and read the contents line by line
split up but the delimiters and get the data I needbut this is what has
to happen.
If PHP is on line 1, do nothing (it's needs two lines to compare against)

If it's on line 2, then subtract Line 1, OctetsOut from Line Line 2
OctetsOut. Then do the same with the UnixTime. Now run a calculation on that
data and push that into an array as the first data point. Now move on, with
a loop I would assume, and do the same for lines 2 and 3, and so on, until
we reach the end.

There could be 5 lines or 500 lines.

I can loop through the file and do everything, the biggest problem I am
having is getting the data on the line PHP is currently on, and then
subtracting the line prior to it. I just can't seem to get a grasp on it.



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




Re: [PHP] File Modification Date/Time

2003-01-03 Thread Christopher J. Crane
Doyou know how to compare time. I would like to get the difference in time
from now to when the file was last accessed.

I was thinking something like this:
\n";
$TimeNow = time();
if ($handle = opendir($DirToCheck)) {
while (false !== ($file = readdir($handle))) {
  $FileTimeUnix = fileatime($DirToCheck . $file);
  $TimeDiff = $TimeNow - $FileTimeUnix;
echo "  $file - Last accessed: " . date("F d Y H:i:s.",
fileatime($DirToCheck . $file)) . " - $TimeDiff\n";
   if($TimeDiff > 1) { unlink($DirToCheck . $file); }
  $TimeDiff = 0;
 }
closedir($handle);
 }
?>

"Marek Kilimajer" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> you must prepend $DirToCheck to $file:
>
> filemtime($DirToCheck . $file)
>
>
>
> Christopher J. Crane wrote:
>
> >I am trying to parse through a directory and get the modification dates
of
> >the file.
> >
> > >$DirToCheck = "tempdata/";
> >if ($handle = opendir($DirToCheck)) {
> >while (false !== ($file = readdir($handle))) {
> >echo "  $file - Last Modified: " . date("F d Y H:i:s.",
> >filemtime($file)) . "\n";
> > }
> >closedir($handle);
> > }
> >?>
> >
> >All the files are coming back with a date of December 31 1969 19:00:00.
What
> >am I doing wrong? The next step is I want to check if the file is older
than
> >30 minutes and if so, I want to delete it. How would I go about that?
> >
> >
> >
> >
> >
> >
>



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




Re: [PHP] File Modification Date/Time

2003-01-03 Thread Christopher J. Crane
Oh that would make sense. I was think ahead. I thought the file was loaded
into an array and I was like "foreach" in the array. So simple, I didn't see
it.

Thank you!

"Marek Kilimajer" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> you must prepend $DirToCheck to $file:
>
> filemtime($DirToCheck . $file)
>
>
>
> Christopher J. Crane wrote:
>
> >I am trying to parse through a directory and get the modification dates
of
> >the file.
> >
> > >$DirToCheck = "tempdata/";
> >if ($handle = opendir($DirToCheck)) {
> >while (false !== ($file = readdir($handle))) {
> >echo "  $file - Last Modified: " . date("F d Y H:i:s.",
> >filemtime($file)) . "\n";
> > }
> >closedir($handle);
> > }
> >?>
> >
> >All the files are coming back with a date of December 31 1969 19:00:00.
What
> >am I doing wrong? The next step is I want to check if the file is older
than
> >30 minutes and if so, I want to delete it. How would I go about that?
> >
> >
> >
> >
> >
> >
>



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




[PHP] File Modification Date/Time

2003-01-03 Thread Christopher J. Crane
I am trying to parse through a directory and get the modification dates of
the file.

\n";
 }
closedir($handle);
 }
?>

All the files are coming back with a date of December 31 1969 19:00:00. What
am I doing wrong? The next step is I want to check if the file is older than
30 minutes and if so, I want to delete it. How would I go about that?




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




[PHP] Date Subtraction

2002-12-23 Thread Christopher J. Crane
I have two periods in time from a Cisco router that I would like to find the
difference in seconds. I am not sure the best way to do this since it is not
a date, but rather an amount of time since last reset.

Here is the numbers

181 days, 7:11:06.66
//stands for 181 days, 7 hours, 11 minutes, 6.66 seconds.

The next is

181 days, 7:16:6.75
//stands for 181 days, 7 hours, 16 minutes, 7.75 seconds.

I would probably shave off the .66 and .75 seconds while it was still a
string. It may be faster to round when it's in seconds, I really don't know.
Then what do I do?

I was thinking of using strtotime(); but because it's not really a date, I
am at a loss for what to do.

Any help with this would be great.



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




Re: [PHP] Re: Ping on Win32

2002-12-04 Thread Christopher J. Crane
Oh man...it's always the simple things you over look...thank you.
"Jason Wong" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> On Thursday 05 December 2002 04:08, Christopher J. Crane wrote:
> > This is the output I get and you can see that on the lines where the
loss
> > is 0% it still says 100%
>
> > >  if($Results2 = "100% loss") { print "
> Try
>
>   if ($Results2 == "100% loss")
>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.biz
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
>
> /*
> QOTD:
> "I never met a man I couldn't drink handsome."
> */
>



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




[PHP] Re: Ping on Win32

2002-12-04 Thread Christopher J. Crane
This is the output I get and you can see that on the lines where the loss is
0% it still says 100%
1 - Pinging 10.200.26.1 with 32 bytes of data:
2 - Request timed out.
3 - Ping statistics for 10.200.26.1:
4 - Packets: Sent = 1, Received = 0, Lost = 1 (100% loss),
100% loss
5 - Approximate round trip times in milli-seconds:
6 - Minimum = 0ms, Maximum = 0ms, Average = 0ms



1 - Pinging 10.42.71.1 with 32 bytes of data:
2 - Reply from 10.42.71.1: bytes=32 time<10ms TTL=255
3 - Ping statistics for 10.42.71.1:
4 - Packets: Sent = 1, Received = 1, Lost = 0 (0% loss),
100% loss
5 - Approximate round trip times in milli-seconds:
6 - Minimum = 0ms, Maximum = 0ms, Average = 0ms



1 - Pinging 10.200.48.1 with 32 bytes of data:
2 - Request timed out.
3 - Ping statistics for 10.200.48.1:
4 - Packets: Sent = 1, Received = 0, Lost = 1 (100% loss),
100% loss
5 - Approximate round trip times in milli-seconds:
6 - Minimum = 0ms, Maximum = 0ms, Average = 0ms



1 - Pinging 10.42.1.1 with 32 bytes of data:
2 - Reply from 10.42.1.1: bytes=32 time=78ms TTL=254
3 - Ping statistics for 10.42.1.1:
4 - Packets: Sent = 1, Received = 1, Lost = 0 (0% loss),
100% loss
5 - Approximate round trip times in milli-seconds:
6 - Minimum = 78ms, Maximum = 78ms, Average = 78ms




"Christopher J. Crane" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I am trying to get a script to work. The basic idea is to go into a
database
> and grab some IP addresses for my LAN. Then for each one ping it using the
> exec command 1 time. If it is successful print output in green and if it
is
> not, print output in red. This is being done on a Win32 system. The ping
> command returns 6 lines for each IP address. I want to take line 4 and see
> if the result is "100% loss" or "0% loss". Below is what I have, but it
only
> seems to keep the first value and prints it out all the way through. I
know
> it's a problem with the looping somewhere, I just can't figure it out.
>
>  mysql_connect("localhost", "root", "") or die("Could not connect");
> mysql_select_db("Network");
> $Result = mysql_query("SELECT DISTINCT Subnet,SerialIPAddress FROM
> Locations") or die("Invalid query");
>   $output = array();
>  while ($Location = mysql_fetch_assoc($Result)) {
>   // ping some server five times and store output in array $output
>   exec("ping " . $Location["Subnet"] . " -n 1", $output);
>   $Count = 0;
>   while (list(,$val) = each($output)) {
>if($val != "") {
> $Count++;
> print "$Count - $val\n";
> if($Count == 4) {
>  list($Junk1, $Results1) = split("\(", $val);
>  list($Results2, $Junk2) = split("\)", $Results1);
>  if($Results2 = "100% loss") { print " color=\"red\">$Results2\n"; }
>  else { print "$Results2\n"; }
>  }
> }
>}
>   print "\n";
>   }
> mysql_free_result($Result);
> mysql_close();
> ?>
>
>



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




[PHP] Ping on Win32

2002-12-04 Thread Christopher J. Crane
I am trying to get a script to work. The basic idea is to go into a database
and grab some IP addresses for my LAN. Then for each one ping it using the
exec command 1 time. If it is successful print output in green and if it is
not, print output in red. This is being done on a Win32 system. The ping
command returns 6 lines for each IP address. I want to take line 4 and see
if the result is "100% loss" or "0% loss". Below is what I have, but it only
seems to keep the first value and prints it out all the way through. I know
it's a problem with the looping somewhere, I just can't figure it out.

\n";
if($Count == 4) {
 list($Junk1, $Results1) = split("\(", $val);
 list($Results2, $Junk2) = split("\)", $Results1);
 if($Results2 = "100% loss") { print "$Results2\n"; }
 else { print "$Results2\n"; }
 }
}
   }
  print "\n";
  }
mysql_free_result($Result);
mysql_close();
?>



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




Re: [PHP] global variables that are arrays

2002-10-08 Thread Christopher J. Crane

I didn't do it yet.
The script I am working on is large with many variables so I was hoping
someone else would know before I do it.

"Chris Hewitt" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Christopher J. Crane wrote:
>
> >Can I do this?
> >global $Ticker=array();
> >
> I don't know, what happens when you try it?
>
> HTH
> Chris
>
>



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




[PHP] global variables that are arrays

2002-10-08 Thread Christopher J. Crane

Can you global a variable at the same time as making it an array?

I usually do this:
$Ticker = array(); global $Ticker;

Can I do this?
global $Ticker=array();

Thank you.



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




[PHP] Trouble with understanding arrays

2002-10-02 Thread Christopher J. Crane

I am having problems with arrays. I guess I just don't understand them all
that well.
I have an simple array of stock tickers. Then for each ticker I go to Yahoo
to get their current price and try to push the Name of the ticker and it's
value into an associative array(I think). Then I want to sort the array so
the the values are in order from highest to lowest, so I can see the highest
amount as the first position and the lowest as the last position.

Here is my problem; for debuggin purposes I do a print_r(array_values());
and I get the following for output.
Array
(
[0] => 7.28
[1] => 5.20
[2] => 1.969
[3] => 59.63
[4] => 4.43
)

I am not sure why I am getting this. I guess I expected the numerical
positions to be the keys something like:
Array
(
[ikn] => 7.28
[xrx] => 5.20
[danky] => 1.969
[ibm] => 59.63
[rhat] => 4.43
)

Since I am not getting the results I expected I am not sure if the rest is
working correctly because I do not know how to access the first position in
the array, or the last. When I get this working, I will be adding 200
tickers and I would like to get the first 5 and the last 5, expecting them
to be the highest 5 and the lowest 5 respectively. I hope someone will take
the time to halp me.

Thank you in advance.

Here is the code I am working on:

$Tickers = array("ikn", "xrx", "danky", "ibm", "rhat");
$TickersCurrent = array();

 foreach($Tickers as $Ticker) {
   $LookupUrl =
"http://finance.yahoo.com/d/quotes.csv?s=$Ticker&f=l1&e=.txt";;
   $Current = implode('', file("$LookupUrl"));
   $Current = rtrim($Current);
   $TickersCurrent["$Ticker"]=$Current;
   }

// Done for debuggin only
   print "\n";
   print_r(array_values($TickersCurrent));
   print "\n";


   asort ($TickersCurrent);
   reset ($TickersCurrent);

   echo "CTC Indice = " . array_sum($TickersCurrent) . "\n";

   echo "The highest Stock is $TickersCurrent[0]";






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




Re: [PHP] Help with Numbers

2002-10-02 Thread Christopher J. Crane

Thank you very much, I did not know sort would work this way. Makes complete
sense now though. Thansk again I will give it a shot.
"Rasmus Lerdorf" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Sort the arrays and pick off the first and last elements.
>
> On Wed, 2 Oct 2002, Christopher J. Crane wrote:
>
> > I am looking for a way to find the highest 5 and lowest 5 numbers within
300
> > or so numbers. Here is what I have so far...
> >
> > $Tickers = array();
> > $Current = array();
> >
> >
> > // SQL QUERY TO GET TICKERS
> >MSSQL_CONNECT($HostName,$UserName,$Password);
> >mssql_select_db($DBName) or DIE("Table unavailable");
> >
> > $Results = MSSQL_QUERY("SELECT CompanyName,Ticker FROM Company WHERE
> > Ticker != ''");
> >
> > $RowCount = MSSQL_NUM_ROWS($Results);
> > print "$RowCount Number of Tickers\n";
> >
> > if($RowCount != 0) {
> >   for ($i = 0; $Field = MSSQL_FETCH_ARRAY($Results); ++$i) {
> > array_push($Tickers, $Field["Ticker"]); }
> >   }
> >else { print "There was nothing selected in the Query, it may have
been
> > bad."; }
> >
> >
> > foreach($Tickers as $Ticker) { Get Last price on the ticker from
database.
> > and... array_push($Current, $Value); }
> >
> > Now that I have the values in an array I would like to pull out the five
> > highest and the 5 lowest. Is there a way to do thatif not, is there
> > another way to do what I am looking for. I keep thinking I would have to
> > compare each ticker against all the others to verify it's standing...and
> > that seems like a lot of work.
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>



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




[PHP] Help with Numbers

2002-10-02 Thread Christopher J. Crane

I am looking for a way to find the highest 5 and lowest 5 numbers within 300
or so numbers. Here is what I have so far...

$Tickers = array();
$Current = array();


// SQL QUERY TO GET TICKERS
   MSSQL_CONNECT($HostName,$UserName,$Password);
   mssql_select_db($DBName) or DIE("Table unavailable");

$Results = MSSQL_QUERY("SELECT CompanyName,Ticker FROM Company WHERE
Ticker != ''");

$RowCount = MSSQL_NUM_ROWS($Results);
print "$RowCount Number of Tickers\n";

if($RowCount != 0) {
  for ($i = 0; $Field = MSSQL_FETCH_ARRAY($Results); ++$i) {
array_push($Tickers, $Field["Ticker"]); }
  }
   else { print "There was nothing selected in the Query, it may have been
bad."; }


foreach($Tickers as $Ticker) { Get Last price on the ticker from database.
and... array_push($Current, $Value); }

Now that I have the values in an array I would like to pull out the five
highest and the 5 lowest. Is there a way to do thatif not, is there
another way to do what I am looking for. I keep thinking I would have to
compare each ticker against all the others to verify it's standing...and
that seems like a lot of work.



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




[PHP] Re: Htmlentities and Newlines?

2002-09-28 Thread Christopher J. Crane

$Something = str_replace("\n", "", $Something);
This is old but still works well.
"Andre Dubuc" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Perhaps I don't understand the use of 'htmlentities' too well, but I would
> like newlines to be retained/inserted into a db, and then if displayed, to
> produce a new line from a textarea. However, I want the possibility of
> dangerous html excluded (hence the use of 'htmlentities').
>
> Is there some way of excluding '\n \r ' and other newline indicators from
> 'htmlentities()'? Perhaps a combination of preg_match and something else?
I'm
> a bit brained-fried struggling with other errant parts of this code since
6
> am.
>
> Any ideas how I could proceed?
>
>
>
> The code far:
>
>
>  . . .
> /* Verification script. Adds sponsor's name, city, prov, country and
current
> date at end of 'request' string */
> . . .
>
> $request = $_POST['request'];
> $request = ucfirst($request);
> $html = htmlentities($request);
> ^^^
> /* $html defuses all newlines . . . sigh */
>
>
> $title = $_POST['title'];
> $title = ucfirst($title);
> $title = htmlentities($title);
>
>
> $date = date('Y-m-d');
> $preview =
> "{$_SESSION['title']}$html{$_SESSION['sfname']}
> {$_SESSION['ssname']}{$_SESSION['scity']}, {$_SESSION['rprov']}
> {$_SESSION['scountry']}$date";;
>
>
> print "Preview of Request from
> {$_SESSION['sfname']}{$_SESSION['ssname']}";
> . . .
> ?>
>
> Any ideas or advice will be most gratefully accepted.
> Tia,
> Andre



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




[PHP] Re: PHP and MSSQL Problem

2002-09-28 Thread Christopher J. Crane

Thanks for some help. I will look into that. This is not my database so I am
not sure how or why it was setup this way. There is more than 255 characters
in each of these fields.
"@ Edwin" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hello,
>
> ...just wondering...
>
> Are you sure VARCHAR in MS SQL can handle 5000? Should be 255 only? (I'm
not
> really familiar with MS SQL but you can count the number of characters
> returned by php...)
>
> - E
>
>
> "Christopher J. Crane" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > I wrote a simple script to return data from a query. The database is MS
> SQL
> > and the field I am looking to return is a VARCHAR(5000). Everything
seems
> to
> > work except the data returned is not the whole field it is shortened. It
> > only returns a portion of the field.
> >
> > Here is the field:
> > 99 Services, Inc. is a full service IT systems integrator and general
> > contractor specializing in cradle to grave technology planning with
strong
> > emphasis on LAN/WAN design (routing and switching) and deployment of
high
> > speed, fully redundant, high availability networks. 99 Services also
> > provides Internet/Intranet/Website/email systems design.  The company
> > services small to medium sized businesses as well as home offices.
> >
> > Here is what is returned by the PHP:
> > 99 Services, Inc. is a full service IT systems integrator and general
> > contractor specializing in cradle to grave technology planning with
strong
> > emphasis on LAN/WAN design (routing and switching) and deployment of
high
> > speed, fully redundant, high availab
> >
> >
> > Here is the script:
> >  > /* CTC Profile about Company */
> > /* = */
> > $HostName = "DAS54-DAL-SBC";
> > $UserName = "***"; //changed for security
> > $Password = ""; //changed for security
> > $DBName = "DirectoryDB";
> >
> > MSSQL_CONNECT($HostName,$UserName,$Password);
> > mssql_select_db($DBName) or DIE("Table unavailable");
> >
> > $ProfileResults = MSSQL_QUERY("SELECT * FROM CompanyProfile WHERE
> > CompanyID = '$ID'");
> > $RowCount = MSSQL_NUM_ROWS($ProfileResults);
> >
> > if($RowCount != 0) {
> >   for ($i = 0; $Field2 = MSSQL_FETCH_ARRAY($ProfileResults); ++$i) {
> >   $Profile = $Field2["Profile"];
> > echo $Field2["CompanyID"] . "" . $Field2["Profile"] .
> > "To read more information about this ";
> > echo "company, visit their website\n";
> >  }
> >}
> >  else { print "This company, $sym is not listed in the CTC
Directory."; }
> >
> > MSSQL_CLOSE();
> > ?>
> >
> >
>



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




[PHP] Re: Carriage returns don't display in HTML

2002-09-28 Thread Christopher J. Crane

On thing you could do is output tags around the text you want to
display. The <> tags keeps simple formatting like tabs and new line
characters.
"Shane" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
Greetings folks.

I need my carriage returns to show up in my HTML output from my text form
field.

There is a JavaScript function that will convert carriage return to 
tags, but is there a PHP function that will add  or  tags to a text
form field in place of the carriage returns a user might add.

Thanks in advance!
-NorthBayShane



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




[PHP] PHP and MSSQL Problem

2002-09-28 Thread Christopher J. Crane

I wrote a simple script to return data from a query. The database is MS SQL
and the field I am looking to return is a VARCHAR(5000). Everything seems to
work except the data returned is not the whole field it is shortened. It
only returns a portion of the field.

Here is the field:
99 Services, Inc. is a full service IT systems integrator and general
contractor specializing in cradle to grave technology planning with strong
emphasis on LAN/WAN design (routing and switching) and deployment of high
speed, fully redundant, high availability networks. 99 Services also
provides Internet/Intranet/Website/email systems design.  The company
services small to medium sized businesses as well as home offices.

Here is what is returned by the PHP:
99 Services, Inc. is a full service IT systems integrator and general
contractor specializing in cradle to grave technology planning with strong
emphasis on LAN/WAN design (routing and switching) and deployment of high
speed, fully redundant, high availab


Here is the script:
" . $Field2["Profile"] .
"To read more information about this ";
echo "company, visit their website\n";
 }
   }
 else { print "This company, $sym is not listed in the CTC Directory."; }

MSSQL_CLOSE();
?>



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




[PHP] MS SQL Problem

2002-09-12 Thread Christopher J. Crane

I am trying to get a script to work to retrieve data from a MS SQL database.
I also tried using a ODBC connection, but that didn't work either.

Here is the error I get;
Warning: MS SQL: Unable to connect to server: LocalServer in
 C:\WEBS\CTTechCouncil\stocks\mssql.php on line 7
 DATABASE FAILED TO RESPOND.

Here is what I have:

 0) :
 print "Data:\n";

 while ($i < $number) :
 $name = mssql_result($result,$i,"CompanyName");
 print $name;
 print "
 ";
 $i++;
 endwhile;
endif;
?>



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




[PHP] Javascript ?

2002-09-04 Thread Christopher J. Crane

Does anyone know of a Javascript forum like this one that I can post a
question to?



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




Re: [PHP] Returning Rows Question

2002-09-04 Thread Christopher J. Crane

That's what I thought it meant but I have never seen it writte nthat way.
Thank you very much
- Original Message -
From: "Ashley M. Kirchner" <[EMAIL PROTECTED]>
To: "Christopher J. Crane" <[EMAIL PROTECTED]>
Cc: "Mike richardson" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Wednesday, September 04, 2002 7:10 PM
Subject: Re: [PHP] Returning Rows Question


> "Christopher J. Crane" wrote:
>
> > >$color = ($color == "FF")? "EAEAEA" : "FF";
>
>  Break it down:
>
>  $color =   (we don't care right now)
>
>  That  is:  ($color == "FF")? "EAEAEA" : "FF"
>
>  And that says:  Evaluate the (current) variable $color.
>
>  Is it FF?  if so, change it to EAEAEA, otherwise make it FF
>
>  $color == "FF" ? (yes) change to "EAEAEA" : (no) make it FF
>
> --
> W | I haven't lost my mind; it's backed up on tape somewhere.
>   +
>   Ashley M. Kirchner <mailto:[EMAIL PROTECTED]>   .   303.442.6410 x130
>   IT Director / SysAdmin / WebSmith . 800.441.3873 x130
>   Photo Craft Laboratories, Inc.. 3550 Arapahoe Ave. #6
>   http://www.pcraft.com . .  ..   Boulder, CO 80303, U.S.A.
>
>
>
>
>
>





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




Re: [PHP] Returning Rows Question

2002-09-04 Thread Christopher J. Crane

Thanks. I will give it a shot. I have never seen anything written like that.
Can you give me a brief explanation of what it means?

Thanks again.
- Original Message -
From: "Mike richardson" <[EMAIL PROTECTED]>
To: "'Christopher J. Crane'" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Wednesday, September 04, 2002 7:03 PM
Subject: RE: [PHP] Returning Rows Question


>
> While(  ) {
>...
>
>$color = ($color == "FF")? "EAEAEA" : "FFFFFF";
>print "\n";
>
>...
> }
>
> -Original Message-
> From: Christopher J. Crane [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, September 04, 2002 3:56 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Returning Rows Question
>
>
> How do you alternate colors of the rows in a table inside a while
> statement when dealing with the output of data from a DB. I am sure it's
> something simple but I keep getting into some really long math thing...
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
>
>
>





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




[PHP] Returning Rows Question

2002-09-04 Thread Christopher J. Crane

How do you alternate colors of the rows in a table inside a while statement
when dealing with the output of data from a DB. I am sure it's something
simple but I keep getting into some really long math thing...



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




[PHP] Re: Host

2002-08-27 Thread Christopher J. Crane

cedant web hosing...cedant.com. They will bill you and you can pay by check
and with Mysql databse I think they are 12.00
"Bruce Karstedt" <[EMAIL PROTECTED]> wrote in message
003b01c24e2b$7a9c9e80$7772d73f@c3">news:003b01c24e2b$7a9c9e80$7772d73f@c3...
> Anyone care to recommend a host as follows:
>
> Unix
> PHP
> MySQL
> Domain Reg.
> No unusual size or traffic requirements (now)
>
> Pay by Check (my company will not allow the used of company credit cards
> over the Internet.)
>
> Bruce Karstedt
> President
> Technology Consulting Associates, Ltd.
> Tel: 847-735-9488
> Fax: 847-735-9474
>



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




[PHP] People's Opinion

2002-08-27 Thread Christopher J. Crane

This is a little off topic, but I am desperate. I am looking for a good
PHP/MySQL chat that is not in a bunch of frames. I have from WebChat
(http://www.webdev.ro/) but it has a bunch of runtime erros. If anyone has
this working or they know of another that works well please send me a link
or something anything

Thank you in advance for your time and support.



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




[PHP] Re: PHP Errors - someone please take a look

2002-08-10 Thread Christopher J. Crane

I did and got the same error.

"Joni JäRvinen" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi.
>
> This isn't the most helpful comment but it seems your working on a
> windows-platform.
> Have you tried to use your script in a *nix platform?
>
> -- Joni
> --
> // Joni Järvinen
> // [EMAIL PROTECTED]
> // http://www.reactorbox.org/~wandu
>
> "Christopher J. Crane" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > I get the following errors when I run my script. It works fine with only
> 20
> > records, but at 100 I get errors.
> >
> > "PHP has encountered an Access Violation at 00DA088E Warning: Unknown
list
> > entry type in request shutdown (2) in
> > c:\www\htdocs\demos\ct.org\directory.php on line 0"
> >
> > or
> >
> >  "PHP has encountered an Access Violation at 00DA088E "
> >
> > Basically, I have a CSV file with about 3500 records (lines). I have a
> while
> > statement that goes through the file line by line. I am using fgetcsv().
> > While on a line I also open another file and search for a matching field
> > (CustomerID) and if it matches print the information on that line unless
a
> > field in that file is set to "1".
> >
> > This was initially tried using a query since this data is in a database.
> > That did not work. I exported the data into csv files. It worked in
> testing
> > limiting the amount of records to be displayed to less than 30. I just
> tried
> > it with limit set to 100 and that's when I got the problem.
> >
> > Here is the code;
> >  > /* INFORMATION:
> >  ____
> >   __/_/\_\__
> >__|__|__
> >   (___O)  (O___)
> >  (_O)   Christopher J. Crane (O_)
> >  (_O)   Web Designer (O_)
> >   (__O)  I N X D E S I G N (O__)
> >  |  http://inxdesign.com|
> >  |  [EMAIL PROTECTED]|
> >  |  |
> >  |__|
> > This script was created to help prepare the directory information, for
the
> > Connecticut Technical Council for the Year 2002.
> >
> > My Material - Please do not copy or modify it with checking with me
first.
> > ([EMAIL PROTECTED])
> > Please leave the INFORMATION banner in place.
> > */
> >
> >
> > file://==Global Definitions
> > file://
> > define('SCRIPT_NAME', 'Connecticut Technology Council Directory Maker');
> > define('SCRIPT_VERSION', 'v1.0');
> > define('SCRIPT_CREATOR', ' href="mailto:[EMAIL PROTECTED]";>Christopher
> > J. Crane');
> > define('CREATE_DATE', '08/06/02');
> > define('REVISED_DATE', '08/06/02');
> >
> >
> > $TestingMode = "On"; file://On or Off
> > $ShowCount = "10";
> >
> > $row = 0;
> > print "Company Directory 2002";
> > print "T e s t i n gM o d e - ";
> >  if($TestingMode == "On") { print "OnOnly Showing The First
$ShowCount
> > Records.\n"; }
> >  else { print "Off\n"; }
> > print "End";
> > print "\n";
> >
> >
> > file://==C o m p a n y   D a t a   O u t p u t
> > file://===
> > $Data1 = fopen("Final.csv","r");
> >  while ($Line1 = fgetcsv($Data1, 1000, ",")) {
> >   $CompanyID = $Line1[0];   $CompanyName = $Line1[1]; $MemberTypeID =
> > $Line1[2];
> >   $RevenueID = $Line1[3];   $Ownership = $Line1[4];  $NoPubRevenue =
> > $Line1[5];
> >   $YearEstablished = $Line1[6]; $Exchange = $Line1[7];  $TotalEmployees
=
> > $Line1[8];
> >   $ConnEmployees = $Line1[9];  $Ticker = $Line1[10];  $Email =
$Line1[11];
> >   $Website = $Line1[12];   $IndustryID = $Line1[13]; $AddressTypeID =
> > $Line1[14];
> >   $AddressLine1 = $Line1[15];  $AddressLine2 = $Line1[16]; $City =
> > $Line1[17];
> >   $State = $Line1[18];   $Zip = $Line1[19];   $CountyName = $Line1[20];
> >   $Profile = $Line1[21];
> >
> &

[PHP] Access Violations with PHP Please Help Please

2002-08-10 Thread Christopher J. Crane

I get the following errors when I run my script. It works fine with only 20
records, but at 100 I get errors.

"PHP has encountered an Access Violation at 00DA088E Warning: Unknown list
entry type in request shutdown (2) in
c:\www\htdocs\demos\ct.org\directory.php on line 0"

or

 "PHP has encountered an Access Violation at 00DA088E "

Basically, I have a CSV file with about 3500 records (lines). I have a while
statement that goes through the file line by line. I am using fgetcsv().
While on a line I also open another file and search for a matching field
(CustomerID) and if it matches print the information on that line unless a
field in that file is set to "1".

This was initially tried using a query since this data is in a database.
That did not work. I exported the data into csv files. It worked in testing
limiting the amount of records to be displayed to less than 30. I just tried
it with limit set to 100 and that's when I got the problem.

Here is the code;
http://inxdesign.com|
 |  [EMAIL PROTECTED]|
 |  |
 |__|
This script was created to help prepare the directory information, for the
Connecticut Technical Council for the Year 2002.

My Material - Please do not copy or modify it with checking with me first.
([EMAIL PROTECTED])
Please leave the INFORMATION banner in place.
*/


file://==Global Definitions
file://
define('SCRIPT_NAME', 'Connecticut Technology Council Directory Maker');
define('SCRIPT_VERSION', 'v1.0');
define('SCRIPT_CREATOR', 'mailto:[EMAIL PROTECTED]";>Christopher
J. Crane');
define('CREATE_DATE', '08/06/02');
define('REVISED_DATE', '08/06/02');


$TestingMode = "On"; file://On or Off
$ShowCount = "10";

$row = 0;
print "Company Directory 2002";
print "T e s t i n gM o d e - ";
 if($TestingMode == "On") { print "OnOnly Showing The First $ShowCount
Records.\n"; }
 else { print "Off\n"; }
print "End";
print "\n";


file://==C o m p a n y   D a t a   O u t p u t
file://===
$Data1 = fopen("Final.csv","r");
 while ($Line1 = fgetcsv($Data1, 1000, ",")) {
  $CompanyID = $Line1[0];   $CompanyName = $Line1[1]; $MemberTypeID =
$Line1[2];
  $RevenueID = $Line1[3];   $Ownership = $Line1[4];  $NoPubRevenue =
$Line1[5];
  $YearEstablished = $Line1[6]; $Exchange = $Line1[7];  $TotalEmployees =
$Line1[8];
  $ConnEmployees = $Line1[9];  $Ticker = $Line1[10];  $Email = $Line1[11];
  $Website = $Line1[12];   $IndustryID = $Line1[13]; $AddressTypeID =
$Line1[14];
  $AddressLine1 = $Line1[15];  $AddressLine2 = $Line1[16]; $City =
$Line1[17];
  $State = $Line1[18];   $Zip = $Line1[19];   $CountyName = $Line1[20];
  $Profile = $Line1[21];

  if($row != 0) {
   print " $CompanyName\n";
   if($AddressLine1 != "") { print "$AddressLine1\n"; }
   if($AddressLine2 != "") { print "$AddressLine2\n"; }
   print "$City, $State $Zip\n";


file://==P h o n e   D a t a   O u t p u t
file://===
$Data2 = fopen("PhoneTable.csv","r");
 while ($Line2 = fgetcsv ($Data2, 1000, ",")) {
  $CompanyID2 = $Line2[0]; $PhoneType = $Line2[1]; $AreaCode = $Line2[2];
  $Prefix = $Line2[3];  $Suffix = $Line2[4];

  if($CompanyID2 == $CompanyID) {
   if($PhoneType == "Office") {
print "Phone:
($AreaCode)$Prefix-$Suffix"; }
}
   }
fclose($Data2);


file://==F a x   D a t a   O u t p u t
file://===
$Data3 = fopen("PhoneTable.csv","r");
 while ($Line3 = fgetcsv ($Data3, 1000, ",")) {
  $CompanyID3 = $Line3[0]; $PhoneType = $Line3[1]; $AreaCode = $Line3[2];
  $Prefix = $Line3[3];  $Suffix = $Line3[4];

  if($CompanyID3 == $CompanyID) {
   if($PhoneType == "FAX") {
print "Fax:
($AreaCode)$Prefix-$Suffix"; }
}
   }
fclose($Data3);
print "";


file://==W e b s i t e / E m a i l  D a t a   O u t p u t
file://==
if(($Website != "") || ($Email != "[EMAIL PROTECTED]")) {
 if($Website != "") { print "Website: $Website\n"; }
 if($Email != "[EMAIL PROTECTED]") { print "E-Mail: $Email\n"; }
 }


file://==O w n e r s h i p   D a t a   O u t p u t
file://===
print "Ownership: ";
 if($Ownership == "1") { print "Private  "; }
 if($Ownership == "2") {
  print "Public  ";
  if(!($Exchange == "OTHER" or $Exchange == "")) { 

[PHP] PHP Errors - someone please take a look

2002-08-10 Thread Christopher J. Crane

I get the following errors when I run my script. It works fine with only 20
records, but at 100 I get errors.

"PHP has encountered an Access Violation at 00DA088E Warning: Unknown list
entry type in request shutdown (2) in
c:\www\htdocs\demos\ct.org\directory.php on line 0"

or

 "PHP has encountered an Access Violation at 00DA088E "

Basically, I have a CSV file with about 3500 records (lines). I have a while
statement that goes through the file line by line. I am using fgetcsv().
While on a line I also open another file and search for a matching field
(CustomerID) and if it matches print the information on that line unless a
field in that file is set to "1".

This was initially tried using a query since this data is in a database.
That did not work. I exported the data into csv files. It worked in testing
limiting the amount of records to be displayed to less than 30. I just tried
it with limit set to 100 and that's when I got the problem.

Here is the code;
http://inxdesign.com|
 |  [EMAIL PROTECTED]|
 |  |
 |__|
This script was created to help prepare the directory information, for the
Connecticut Technical Council for the Year 2002.

My Material - Please do not copy or modify it with checking with me first.
([EMAIL PROTECTED])
Please leave the INFORMATION banner in place.
*/


file://==Global Definitions
file://
define('SCRIPT_NAME', 'Connecticut Technology Council Directory Maker');
define('SCRIPT_VERSION', 'v1.0');
define('SCRIPT_CREATOR', 'mailto:[EMAIL PROTECTED]";>Christopher
J. Crane');
define('CREATE_DATE', '08/06/02');
define('REVISED_DATE', '08/06/02');


$TestingMode = "On"; file://On or Off
$ShowCount = "10";

$row = 0;
print "Company Directory 2002";
print "T e s t i n gM o d e - ";
 if($TestingMode == "On") { print "OnOnly Showing The First $ShowCount
Records.\n"; }
 else { print "Off\n"; }
print "End";
print "\n";


file://==C o m p a n y   D a t a   O u t p u t
file://===
$Data1 = fopen("Final.csv","r");
 while ($Line1 = fgetcsv($Data1, 1000, ",")) {
  $CompanyID = $Line1[0];   $CompanyName = $Line1[1]; $MemberTypeID =
$Line1[2];
  $RevenueID = $Line1[3];   $Ownership = $Line1[4];  $NoPubRevenue =
$Line1[5];
  $YearEstablished = $Line1[6]; $Exchange = $Line1[7];  $TotalEmployees =
$Line1[8];
  $ConnEmployees = $Line1[9];  $Ticker = $Line1[10];  $Email = $Line1[11];
  $Website = $Line1[12];   $IndustryID = $Line1[13]; $AddressTypeID =
$Line1[14];
  $AddressLine1 = $Line1[15];  $AddressLine2 = $Line1[16]; $City =
$Line1[17];
  $State = $Line1[18];   $Zip = $Line1[19];   $CountyName = $Line1[20];
  $Profile = $Line1[21];

  if($row != 0) {
   print " $CompanyName\n";
   if($AddressLine1 != "") { print "$AddressLine1\n"; }
   if($AddressLine2 != "") { print "$AddressLine2\n"; }
   print "$City, $State $Zip\n";


file://==P h o n e   D a t a   O u t p u t
file://===
$Data2 = fopen("PhoneTable.csv","r");
 while ($Line2 = fgetcsv ($Data2, 1000, ",")) {
  $CompanyID2 = $Line2[0]; $PhoneType = $Line2[1]; $AreaCode = $Line2[2];
  $Prefix = $Line2[3];  $Suffix = $Line2[4];

  if($CompanyID2 == $CompanyID) {
   if($PhoneType == "Office") {
print "Phone:
($AreaCode)$Prefix-$Suffix"; }
}
   }
fclose($Data2);


file://==F a x   D a t a   O u t p u t
file://===
$Data3 = fopen("PhoneTable.csv","r");
 while ($Line3 = fgetcsv ($Data3, 1000, ",")) {
  $CompanyID3 = $Line3[0]; $PhoneType = $Line3[1]; $AreaCode = $Line3[2];
  $Prefix = $Line3[3];  $Suffix = $Line3[4];

  if($CompanyID3 == $CompanyID) {
   if($PhoneType == "FAX") {
print "Fax:
($AreaCode)$Prefix-$Suffix"; }
}
   }
fclose($Data3);
print "";


file://==W e b s i t e / E m a i l  D a t a   O u t p u t
file://==
if(($Website != "") || ($Email != "[EMAIL PROTECTED]")) {
 if($Website != "") { print "Website: $Website\n"; }
 if($Email != "[EMAIL PROTECTED]") { print "E-Mail: $Email\n"; }
 }


file://==O w n e r s h i p   D a t a   O u t p u t
file://===
print "Ownership: ";
 if($Ownership == "1") { print "Private  "; }
 if($Ownership == "2") {
  print "Public  ";
  if(!($Exchange == "OTHER" or $Exchange == "")) { 

[PHP] Re: JPgraph: Autoscaling [OT perhaps]

2002-08-09 Thread Christopher J. Crane

Just so you don't feel alone.
I use jpgraph alot, however, I have not run into this problem.
What version of jpgraph are you suning.
"Lee P. Reilly" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Anybody out there using JpGraph? I directed the following question to
> the support web site, but as yet... there's been no reply:
>
> Could somebody tell me how to disable the autoscaling in JpGraph, and/or
>
> how to provide my own scaling? It's perfect for 99% of the graphs and
> plots I create, but when I plot some data in a linearXlogY scale it's
> surrounded by way too much white space. Particularly, I've noticed that
> the logY scale always seems to go from 10,000 to 100,000 for my data
> sets when the Y range is only from 20k to 10k.
>
> E.g. Say I had 2 data points : 1,5 and 5,1
>  +The graph may show a grid e.g. 10 x 10
>  + How can I set it so that it only pads a few pixels, or say display
> 0,0 up to 6,6?
>
> Does this make sense? Hope someone can help!
>
> While I'm on the topic, does JpGraph support Sub/SuperScript text?
> Nothing about it in the documentation, but I need to display N^2 (N
> squared) and stuff like that.
>
> Thanks in advance,
> Lee
>
> PS: JpGraph is an awesome little library ;-)
>
>
>



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




[PHP] (HELP) - PHP has encountered an Access Violation

2002-08-09 Thread Christopher J. Crane

I get the following errors when I run my script. It works fine with only 20
records, but at 100 I get errors.

"PHP has encountered an Access Violation at 00DA088E Warning: Unknown list
entry type in request shutdown (2) in
c:\www\htdocs\demos\ct.org\directory.php on line 0"

or

 "PHP has encountered an Access Violation at 00DA088E "

Basically, I have a CSV file with about 3500 records (lines). I have a while
statement that goes through the file line by line. I am using fgetcsv().
While on a line I also open another file and search for a matching field
(CustomerID) and if it matches print the information on that line unless a
field in that file is set to "1".

This was initially tried using a query since this data is in a database.
That did not work. I exported the data into csv files. It worked in testing
limiting the amount of records to be displayed to less than 30. I just tried
it with limit set to 100 and that's when I got the problem.

Here is the code;
http://inxdesign.com|
 |  [EMAIL PROTECTED]|
 |  |
 |__|
This script was created to help prepare the directory information, for the
Connecticut Technical Council for the Year 2002.

My Material - Please do not copy or modify it with checking with me first.
([EMAIL PROTECTED])
Please leave the INFORMATION banner in place.
*/


file://==Global Definitions
file://
define('SCRIPT_NAME', 'Connecticut Technology Council Directory Maker');
define('SCRIPT_VERSION', 'v1.0');
define('SCRIPT_CREATOR', 'mailto:[EMAIL PROTECTED]";>Christopher
J. Crane');
define('CREATE_DATE', '08/06/02');
define('REVISED_DATE', '08/06/02');


$TestingMode = "On"; file://On or Off
$ShowCount = "10";

$row = 0;
print "Company Directory 2002";
print "T e s t i n gM o d e - ";
 if($TestingMode == "On") { print "OnOnly Showing The First $ShowCount
Records.\n"; }
 else { print "Off\n"; }
print "End";
print "\n";


file://==C o m p a n y   D a t a   O u t p u t
file://===
$Data1 = fopen("Final.csv","r");
 while ($Line1 = fgetcsv($Data1, 1000, ",")) {
  $CompanyID = $Line1[0];   $CompanyName = $Line1[1]; $MemberTypeID =
$Line1[2];
  $RevenueID = $Line1[3];   $Ownership = $Line1[4];  $NoPubRevenue =
$Line1[5];
  $YearEstablished = $Line1[6]; $Exchange = $Line1[7];  $TotalEmployees =
$Line1[8];
  $ConnEmployees = $Line1[9];  $Ticker = $Line1[10];  $Email = $Line1[11];
  $Website = $Line1[12];   $IndustryID = $Line1[13]; $AddressTypeID =
$Line1[14];
  $AddressLine1 = $Line1[15];  $AddressLine2 = $Line1[16]; $City =
$Line1[17];
  $State = $Line1[18];   $Zip = $Line1[19];   $CountyName = $Line1[20];
  $Profile = $Line1[21];

  if($row != 0) {
   print " $CompanyName\n";
   if($AddressLine1 != "") { print "$AddressLine1\n"; }
   if($AddressLine2 != "") { print "$AddressLine2\n"; }
   print "$City, $State $Zip\n";


file://==P h o n e   D a t a   O u t p u t
file://===
$Data2 = fopen("PhoneTable.csv","r");
 while ($Line2 = fgetcsv ($Data2, 1000, ",")) {
  $CompanyID2 = $Line2[0]; $PhoneType = $Line2[1]; $AreaCode = $Line2[2];
  $Prefix = $Line2[3];  $Suffix = $Line2[4];

  if($CompanyID2 == $CompanyID) {
   if($PhoneType == "Office") {
print "Phone:
($AreaCode)$Prefix-$Suffix"; }
}
   }
fclose($Data2);


file://==F a x   D a t a   O u t p u t
file://===
$Data3 = fopen("PhoneTable.csv","r");
 while ($Line3 = fgetcsv ($Data3, 1000, ",")) {
  $CompanyID3 = $Line3[0]; $PhoneType = $Line3[1]; $AreaCode = $Line3[2];
  $Prefix = $Line3[3];  $Suffix = $Line3[4];

  if($CompanyID3 == $CompanyID) {
   if($PhoneType == "FAX") {
print "Fax:
($AreaCode)$Prefix-$Suffix"; }
}
   }
fclose($Data3);
print "";


file://==W e b s i t e / E m a i l  D a t a   O u t p u t
file://==
if(($Website != "") || ($Email != "[EMAIL PROTECTED]")) {
 if($Website != "") { print "Website: $Website\n"; }
 if($Email != "[EMAIL PROTECTED]") { print "E-Mail: $Email\n"; }
 }


file://==O w n e r s h i p   D a t a   O u t p u t
file://===
print "Ownership: ";
 if($Ownership == "1") { print "Private  "; }
 if($Ownership == "2") {
  print "Public  ";
  if(!($Exchange == "OTHER" or $Exchange == "")) { 

[PHP] Huge Problem

2002-08-09 Thread Christopher J. Crane

I get the following errors when I run my script. It works fine with only 20
records, but at 100 I get errors.

"PHP has encountered an Access Violation at 00DA088E Warning: Unknown list
entry type in request shutdown (2) in
c:\www\htdocs\demos\ct.org\directory.php on line 0"

or

 "PHP has encountered an Access Violation at 00DA088E "

Basically, I have a CSV file with about 3500 records (lines). I have a while
statement that goes through the file line by line. I am using fgetcsv().
While on a line I also open another file and search for a matching field
(CustomerID) and if it matches print the information on that line unless a
field in that file is set to "1".

This was initially tried using a query since this data is in a database.
That did not work. I exported the data into csv files. It worked in testing
limiting the amount of records to be displayed to less than 30. I just tried
it with limit set to 100 and that's when I got the problem.

Here is the code;
http://inxdesign.com|
 |  [EMAIL PROTECTED]|
 |  |
 |__|
This script was created to help prepare the directory information, for the
Connecticut Technical Council for the Year 2002.

My Material - Please do not copy or modify it with checking with me first.
([EMAIL PROTECTED])
Please leave the INFORMATION banner in place.
*/


//==Global Definitions
//
define('SCRIPT_NAME', 'Connecticut Technology Council Directory Maker');
define('SCRIPT_VERSION', 'v1.0');
define('SCRIPT_CREATOR', 'mailto:[EMAIL PROTECTED]";>Christopher
J. Crane');
define('CREATE_DATE', '08/06/02');
define('REVISED_DATE', '08/06/02');


$TestingMode = "On"; file://On or Off
$ShowCount = "10";

$row = 0;
print "Company Directory 2002";
print "T e s t i n gM o d e - ";
 if($TestingMode == "On") { print "OnOnly Showing The First $ShowCount
Records.\n"; }
 else { print "Off\n"; }
print "End";
print "\n";


//==C o m p a n y   D a t a   O u t p u t
//===
$Data1 = fopen("Final.csv","r");
 while ($Line1 = fgetcsv($Data1, 1000, ",")) {
  $CompanyID = $Line1[0];   $CompanyName = $Line1[1]; $MemberTypeID =
$Line1[2];
  $RevenueID = $Line1[3];   $Ownership = $Line1[4];  $NoPubRevenue =
$Line1[5];
  $YearEstablished = $Line1[6]; $Exchange = $Line1[7];  $TotalEmployees =
$Line1[8];
  $ConnEmployees = $Line1[9];  $Ticker = $Line1[10];  $Email = $Line1[11];
  $Website = $Line1[12];   $IndustryID = $Line1[13]; $AddressTypeID =
$Line1[14];
  $AddressLine1 = $Line1[15];  $AddressLine2 = $Line1[16]; $City =
$Line1[17];
  $State = $Line1[18];   $Zip = $Line1[19];   $CountyName = $Line1[20];
  $Profile = $Line1[21];

  if($row != 0) {
   print " $CompanyName\n";
   if($AddressLine1 != "") { print "$AddressLine1\n"; }
   if($AddressLine2 != "") { print "$AddressLine2\n"; }
   print "$City, $State $Zip\n";


//==P h o n e   D a t a   O u t p u t
//===
$Data2 = fopen("PhoneTable.csv","r");
 while ($Line2 = fgetcsv ($Data2, 1000, ",")) {
  $CompanyID2 = $Line2[0]; $PhoneType = $Line2[1]; $AreaCode = $Line2[2];
  $Prefix = $Line2[3];  $Suffix = $Line2[4];

  if($CompanyID2 == $CompanyID) {
   if($PhoneType == "Office") {
print "Phone:
($AreaCode)$Prefix-$Suffix"; }
}
   }
fclose($Data2);


//==F a x   D a t a   O u t p u t
//===
$Data3 = fopen("PhoneTable.csv","r");
 while ($Line3 = fgetcsv ($Data3, 1000, ",")) {
  $CompanyID3 = $Line3[0]; $PhoneType = $Line3[1]; $AreaCode = $Line3[2];
  $Prefix = $Line3[3];  $Suffix = $Line3[4];

  if($CompanyID3 == $CompanyID) {
   if($PhoneType == "FAX") {
print "Fax:
($AreaCode)$Prefix-$Suffix"; }
}
   }
fclose($Data3);
print "";


//==W e b s i t e / E m a i l  D a t a   O u t p u t
//==
if(($Website != "") || ($Email != "[EMAIL PROTECTED]")) {
 if($Website != "") { print "Website: $Website\n"; }
 if($Email != "[EMAIL PROTECTED]") { print "E-Mail: $Email\n"; }
 }


//==O w n e r s h i p   D a t a   O u t p u t
//===
print "Ownership: ";
 if($Ownership == "1") { print "Private  "; }
 if($Ownership == "2") {
  print "Public  ";
  if(!($Exchange == "OTHER" or $Exchange == "")) { print "($Exchange:
$Ticker)  "; }
  }
 if($YearEs

Re: [PHP] Dates and Date()

2002-07-29 Thread Christopher J. Crane

Thank you again.
"Andrey Hristov" <[EMAIL PROTECTED]> wrote in message
01ec01c2371b$77d35b20$1601a8c0@nik">news:01ec01c2371b$77d35b20$1601a8c0@nik...
> The guy just wanted fast help. It is obvious that he is not advanced it
> time transformations and functions. I think that he didn't ask bad
question.
> WHich are bad - his questions or "What the  is php?".
> When he has more time he will take better look at the docs :)) Some people
> always experiment some not.
>
> Kind regards,
> Andrey Hristov
>
>
> - Original Message -----
> From: "1LT John W. Holmes" <[EMAIL PROTECTED]>
> To: "Christopher J. Crane" <[EMAIL PROTECTED]>; "Andrey Hristov"
> <[EMAIL PROTECTED]>
> Cc: <[EMAIL PROTECTED]>
> Sent: Monday, July 29, 2002 7:12 PM
> Subject: Re: [PHP] Dates and Date()
>
>
> > > Ok here is what I did.
> > >  $Hist_Time = gmstrftime('%m:%d:%Y', strtotime("-10 days"));
> > >
> > > Now I am wondering if there is a way to look for only the last day
> > business
> > > days and be returned in an array?
> >
> > What have you tried? How much longer do we have to hold your hand?
> >
> > Not to be too rude or anything, but at least give it a few tries on your
> > own, then post your code, what you thought would happen, what actually
> > happened, and what help you need. That's how these things are supposed
to
> > work...
> >
> > ---John Holmes...
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>



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




Re: [PHP] Dates and Date()

2002-07-29 Thread Christopher J. Crane

Since you leave your name as 1LT, I am assuming that means 1st LT in what
branch of the service...Army probably and the reserves no less.
I am working on a huge project and write lets of code. Mostly MySql stuff. I
did not know how to do this so I asked. Two people were nice enough to help
out.

It seems you are stuck on yourself and thought I was asking you. There are
many levels in this list with over 11000 posts. Some people help people
because others ask for it. If I wanted you opinion, I would have asked for
it.

I have received 11 emails from this list about your post and all thought you
were being a jerk. If you didn't like what I was asking for you could have
simply not read it or responded. Instead, you post your opinion to the
entire group. You could have just sent it to me directly.

It's people like you who intimidate others from sending a post or worse
replying to someone in fear of someone like you who thinks they are better
then everyone else. The name of this list is not "EXPERTS" or "Only after
you tried several times" it is general.


- Original Message -
From: "1LT John W. Holmes" <[EMAIL PROTECTED]>
To: "Christopher J. Crane" <[EMAIL PROTECTED]>; "Andrey Hristov"
<[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Monday, July 29, 2002 12:12 PM
Subject: Re: [PHP] Dates and Date()


> > Ok here is what I did.
> >  $Hist_Time = gmstrftime('%m:%d:%Y', strtotime("-10 days"));
> >
> > Now I am wondering if there is a way to look for only the last day
> business
> > days and be returned in an array?
>
> What have you tried? How much longer do we have to hold your hand?
>
> Not to be too rude or anything, but at least give it a few tries on your
> own, then post your code, what you thought would happen, what actually
> happened, and what help you need. That's how these things are supposed to
> work...
>
> ---John Holmes...
>
>
>




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




Re: [PHP] Dates and Date()

2002-07-29 Thread Christopher J. Crane

very nice... thank you!
- Original Message -
From: "Andrey Hristov" <[EMAIL PROTECTED]>
To: "Christopher J. Crane" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Monday, July 29, 2002 12:04 PM
Subject: Re: [PHP] Dates and Date()


> Use while() with some counter that increments when you have bussiness day/
> $counter = 0;
> $bdays = 0;
> while ($bdays<10){
>   if
>
(in_array(gmstrftime('%u',gmmktime(0,0,0,7,2-($counter++),2002),array(1,2,3,
> 4,5)){
>   $bdays++;
> echo gmstrftime('%m/%d/%Y',gmmktime(0,0,0,7,2-($counter-1),2002);
> }
> }
>
> HTH
>
> Regards,
> Andrey
>
> - Original Message -
> From: "Christopher J. Crane" <[EMAIL PROTECTED]>
> To: "Andrey Hristov" <[EMAIL PROTECTED]>
> Cc: <[EMAIL PROTECTED]>
> Sent: Monday, July 29, 2002 7:00 PM
> Subject: Re: [PHP] Dates and Date()
>
>
> > Ok here is what I did.
> >  $Hist_Time = gmstrftime('%m:%d:%Y', strtotime("-10 days"));
> >
> > Now I am wondering if there is a way to look for only the last day
> business
> > days and be returned in an array?
> > - Original Message -
> > From: "Andrey Hristov" <[EMAIL PROTECTED]>
> > To: "Christopher J. Crane" <[EMAIL PROTECTED]>
> > Cc: <[EMAIL PROTECTED]>
> > Sent: Monday, July 29, 2002 10:59 AM
> > Subject: Re: [PHP] Dates and Date()
> >
> >
> > >
> > >
> > > - Original Message -
> > > From: "Christopher J. Crane" <[EMAIL PROTECTED]>
> > > To: <[EMAIL PROTECTED]>
> > > Sent: Monday, July 29, 2002 5:51 PM
> > > Subject: [PHP] Dates and Date()
> > >
> > >
> > > > I believethisto be one way to find out yesterday's date:
> > > > $tomorrow  = mktime (0,0,0,date("m")  ,date("d")-1,date("Y"));
> > > >
> > > > However, I would like to have a snippet of code to tell me how to
get
> > the
> > > > date of today - 10 days ago.
> > > >
> > > > if today is jul 29, 2002, how do I get the date funtion to tell me
10
> > days
> > > > ago. with jul 29, 2002 as the date it would be easy, just subtract
10
> > from
> > > > 29, but what happens if the date was jul 2, 2002. How do I get the
> > correct
> > > > date returned
> > >
> > > All date functions handle correctly this case
> > >  so echo strftime('%m:%d:%Y', gmmktime(0,0,0,7,2-10,2002));
> > > will be:
> > > 06:22:2002
> > > You can add/substract what you wish and will get correct results in
case
> > the
> > > the resulting timestamp is between 1.1.1970 and somewhere in year
2038.
> > >
> > >
> > > Best regards,
> > > Andrey Hristov
> > >
> > >
> > >
> >
> >
> >
> >
>
>
>




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




Re: [PHP] Dates and Date()

2002-07-29 Thread Christopher J. Crane

Ok here is what I did.
 $Hist_Time = gmstrftime('%m:%d:%Y', strtotime("-10 days"));

Now I am wondering if there is a way to look for only the last day business
days and be returned in an array?
- Original Message -
From: "Andrey Hristov" <[EMAIL PROTECTED]>
To: "Christopher J. Crane" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Monday, July 29, 2002 10:59 AM
Subject: Re: [PHP] Dates and Date()


>
>
> - Original Message -
> From: "Christopher J. Crane" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Monday, July 29, 2002 5:51 PM
> Subject: [PHP] Dates and Date()
>
>
> > I believethisto be one way to find out yesterday's date:
> > $tomorrow  = mktime (0,0,0,date("m")  ,date("d")-1,date("Y"));
> >
> > However, I would like to have a snippet of code to tell me how to get
the
> > date of today - 10 days ago.
> >
> > if today is jul 29, 2002, how do I get the date funtion to tell me 10
days
> > ago. with jul 29, 2002 as the date it would be easy, just subtract 10
from
> > 29, but what happens if the date was jul 2, 2002. How do I get the
correct
> > date returned
>
> All date functions handle correctly this case
>  so echo strftime('%m:%d:%Y', gmmktime(0,0,0,7,2-10,2002));
> will be:
> 06:22:2002
> You can add/substract what you wish and will get correct results in case
the
> the resulting timestamp is between 1.1.1970 and somewhere in year 2038.
>
>
> Best regards,
> Andrey Hristov
>
>
>




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




[PHP] Dates and Date()

2002-07-29 Thread Christopher J. Crane

I believethisto be one way to find out yesterday's date:
$tomorrow  = mktime (0,0,0,date("m")  ,date("d")-1,date("Y"));

However, I would like to have a snippet of code to tell me how to get the
date of today - 10 days ago.

if today is jul 29, 2002, how do I get the date funtion to tell me 10 days
ago. with jul 29, 2002 as the date it would be easy, just subtract 10 from
29, but what happens if the date was jul 2, 2002. How do I get the correct
date returned




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




Re: [PHP] Classes vs. Functions

2002-07-17 Thread Christopher J. Crane

Thank you for your 2 cents I am just learning and appreciate your comments.
- Original Message -
From: "Michael Hall" <[EMAIL PROTECTED]>
To: "Chris Crane" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Tuesday, July 16, 2002 11:13 PM
Subject: Re: [PHP] Classes vs. Functions


>
> There is no simple answer here. I have started using classes where I find
> I am writing a lot of related functions that share similar
> parameters. Database connection and queries are a good
> example. Authentication is another.
>
> I have another class that builds forms, because I just hate the tedium of
> coding HTML forms by hand. It is really just a collection of functions,
> though, and could work fine as such.
>
> I'm still learning/exploring ... I am always guided by the principle that
> whatever makes less work for me (but achieves the same result) is probably
> a good thing.
>
> IMHO classes are best for more universal code that really can be used in
> many different places. My functions tend to be more application specific.
>
> My 2 cents
>
> Michael
>
> On Tue, 16 Jul 2002, Chris Crane wrote:
>
> > Could someone please explain the difference between classes and
functions
> > and how to use a class. I write alot of PHP, but I never understood this
at
> > all. I use an include statement in many of my pages and include a file
with
> > a bunch of functions. For instance, I might have a function called
stock();
> > In the page I am using I include the file that has this function and I
call
> > it like this:
> >
> > stock($Sym);
> >
> > I am wondering if I am doing it the wrong way. So I need to better
> > understand classes. What is one, and why would you use it?
> >
> > Thanks.
> >
> >
> >
> >
>
> --
> 
> n   i   n   t   i  .   c   o   m
> php-python-perl-mysql-postgresql
> 
> Michael Hall [EMAIL PROTECTED]
> 
>
>
>




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




[PHP] Re: PHP Script Speed

2002-07-08 Thread Christopher J. Crane

I use to do it that way, but i like to be able to see it in Dreamweaver for
more control, not so much Frontpage, I don't know how to use front page. I
hope someone helps me figure this out.


"Peter" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I understand what you're getting at, I'm not sure of the answer though.
> I know it would stop you using FrontPage or Dreamweaver but if for example
> you had
>  print "Index page";
> print "Current: $_Current";
> print "Percent Change: $_ChangePercent";
> print "";
> ?>
> You'd eliminate that problem.
>
>
> "Christopher Crane" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > I have a question on speed but also dealing with the method of
scripting.
> > I have a few pages where I get things like weather and stocks. I get the
> > data, which is usually in the form of a Comma delimited string like the
> > stock quotes from Yahoo.com. In the past, I also wrote a function to get
> the
> > data and split into variables like $S_Current, $S_ChangePercent,
> > $S_ChangeDollar ect  Then I would print out a whole HTML table with
> the
> > variables embedded within. This function was called from a PHP type web
> > page. Lately, I have been making the variables global and using them
when
> I
> > need them. For instance, I have a page called index.php. At the stock
> > section of the page, I have a function that is called and returns the
> major
> > indices, like NASDAQ, DOW and S&P. I global the variables and then
within
> > the index.php page I called the variables as I need them in tables. This
> > makes designing the page simple. I can do it in Frontpage or Dreamweaver
> or
> > whatever. The old way was to call the function and the function would
> print
> > out the HTML table as part of the function.
> >
> > I hope I am explaining this well enough to understand. Doing it the
newer
> > way for me with the global variables makes it easier to design the web
> page,
> > but I am wondering if it is at the cost of a slower page loading. The
> reason
> > I think this is whenever I would like to display a variable I have to
put
> in
> > a script tag like . I might have as many as 20
> of
> > these on a page. Every time doesn't PHP have to start again and parse
out
> > this information causing it to be really slow?
> >
> > The old way was for me to call the function like  and
> > then the function would print out;
> > 
> > 
> > Dow
> > NASDAQ
> > S & P
> > 
> > 
> > $Dow_Current
> > $Nas_Current
> > $Snp_Current
> > 
> > 
> >
> > Which is faster? Which is better? Is there another way?
> >
> > Christopher J. Crane
> > Network Operations Manager
> >
> > IKON Office Solutions
> > 860.659.6464
> >
> >
> >
>
>



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




[PHP] JPGraph errors

2002-06-23 Thread Christopher J. Crane

I have gotten JPGraph to work if I suppress the output of errors. I am using
the example of backgroundex02.php.
If I add the line "error_reporting(0);" at the top, I get the graph, if I
remove it...I get the following error;

"
Warning: Use of undefined constant LC_TIME - assumed 'LC_TIME' in
../jpgraph.php on line 474

Warning: Use of undefined constant LC_TIME - assumed 'LC_TIME' in
../jpgraph.php on line 475

Warning: Use of undefined constant LC_TIME - assumed 'LC_TIME' in
../jpgraph.php on line 495

Warning: Cannot add header information - headers already sent by (output
started at ../jpgraph.php:474) in ../jpgraph.php on line 4257
?PNG

"

I assume this is a variable for Local Time, but I don't know where to set
it. Can anyone help me please.



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




[PHP] newbie help please

2002-06-02 Thread Christopher J. Crane

$Tags['issue-name']. So I could print it out. Something like, print
"$Tags['issue-name']\n";

I was able to get a numerical representation of the array like, $Tags[5] and
the value of that tag was "RED HAT", but then I would have to know what the
position of the data I am looking for in the array. I would prefer to know
the tag name and the array and get to the data that way. I know there is a
way to do this, but I just can't figure it out. There is a lot of
information on Parsing the XML file but not getting into a useful array, or
at least that I have found easily to understand.


if(!isset($Sym)) { $Sym = 'IKN'; }
$URI = 'http://quotes.nasdaq.com/quote.dll?page=xml&mode=stock&symbol=';
$simple = implode( '', file("$URI$Sym"));

$p = xml_parser_create();
xml_parse_into_struct($p,$simple,$vals,$index);
xml_parser_free($p);




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




[PHP] PHP Coding Problem

2002-06-01 Thread Christopher J. Crane

Here is a piece of code, that is close to doing what I want it to.
The end result I would like to have is an array that is simple to work with.
If the XML tag was RED HAT, I would like something
like the following:

$Tags['issue-name']. So I could print it out. Something like, print
"$Tags['issue-name']\n";

I was able to get a numerical representation of the array like, $Tags[5] and
the value of that tag was "RED HAT", but then I would have to know what the
position of the data I am looking for in the array. I would prefer to know
the tag name and the array and get to the data that way. I know there is a
way to do this, but I just can't figure it out. There is a lot of
information on Parsing the XML file but not getting into a useful array, or
at least that I have found easily to understand.


if(!isset($Sym)) { $Sym = 'IKN'; }
$URI = 'http://quotes.nasdaq.com/quote.dll?page=xml&mode=stock&symbol=';
$simple = implode( '', file("$URI$Sym"));

$p = xml_parser_create();
xml_parse_into_struct($p,$simple,$vals,$index);
xml_parser_free($p);
file://echo "Index array\n";
file://print_r($index);
file://echo "\nVals array\n";
file://print_r($vals);






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




[PHP] Re: Is PHP used by U.S. Government? By U.S. DoD?

2002-06-01 Thread Christopher J. Crane

Another site that you should be aware of is for both internal and external,
NASA uses PHP and MySQL, of which both are free.
"John Christopher" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>
> I would like to use PHP in a project for a United States
> Government client.  The client is skeptical because PHP
> is not a Microsoft product.  I'm looking for statistics and
> links that show that PHP *is* currently in use by the
> US Government.
>
> Is PHP used by the U.S. Department of Defense?  Examples?
>
> Is PHP a U.S. Military Standard?
>
> Any stats or links would be most helpful.  Thank you.
>
>
> __
> Do You Yahoo!?
> Yahoo! - Official partner of 2002 FIFA World Cup
> http://fifaworldcup.yahoo.com



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




[PHP] XML to ARRAY

2002-06-01 Thread Christopher J. Crane

Here is a piece of code, that is close to doing what I want it to.
The end result I would like to have is an array that is simple to work with.
If the XML tag was RED HAT, I would like something
like the following:

$Tags['issue-name']. So I could print it out. Something like, print
"$Tags['issue-name']\n";

I was able to get a numerical representation of the array like, $Tags[5] and
the value of that tag was "RED HAT", but then I would have to know what the
position of the data I am looking for in the array. I would prefer to know
the tag name and the array and get to the data that way. I know there is a
way to do this, but I just can't figure it out. There is a lot of
information on Parsing the XML file but not getting into a useful array, or
at least that I have found easily to understand.


if(!isset($Sym)) { $Sym = 'IKN'; }
$URI = 'http://quotes.nasdaq.com/quote.dll?page=xml&mode=stock&symbol=';
$simple = implode( '', file("$URI$Sym"));

$p = xml_parser_create();
xml_parse_into_struct($p,$simple,$vals,$index);
xml_parser_free($p);
file://echo "Index array\n";
file://print_r($index);
file://echo "\nVals array\n";
file://print_r($vals);




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




Re: [PHP] Undefined variables

2002-05-30 Thread Christopher J. Crane

I like this piece of code. In fact, I convert all my scripts that use the
older If/Else  code. What would happen if the "break; " wasn't used. Would
it just continue through the rest of the function to find another match???

"Miguel Cruz" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> On Thu, 30 May 2002, Crane, Christopher wrote:
> > if ($Task == "ShowVersion") { function ShowVersion(); }
> > elseif ($Task == "GetData") { function GetData(); print "$DataOutput"; }
> > elseif ($Task == "CreateImage") { function CreateImage(); }
> > else { print "Incorrect Variable or no Variable Supplies"; }
>
> if (isset($Task))
> {
>   switch($Task)
>   {
>   case 'ShowVersion':
> ShowVersion();
> break;
>   case 'GetData':
> GetData;
> print $DataOutput;
> break;
>   case 'CreateImage':
> CreateImage();
> break;
>   default:
> print 'Unknown function';
>   }
> } else {
>   print 'No function supplied';
> }
>
>



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




Re: [PHP] Undefined variables

2002-05-30 Thread Christopher J. Crane

Darren,
Thanks for the tip on direction to head in. Could you provide an example of
what you are referring to?


"Darren Gamble" <[EMAIL PROTECTED]> wrote in message
078EC26E265CD411BD9100508BDFFC860ED3E64E@shawmail02">news:078EC26E265CD411BD9100508BDFFC860ED3E64E@shawmail02...
> Good day,
>
> Just to clarify, Perl will, in fact, complain if you have undefined
> variables (or variables that you use once) if you have warnings and/or
> strict mode in effect.  Using at least one is strongly recommended.
>
> In PHP, the method you're using for getting form data is deprecated.  You
> should use $HTTP_POST_VARS or $_POST, depending on your version.  Check
the
> docco for more info on those.
>
> If you really have to check variables using this method, use isset() to
see
> if the variables ... have been set. =)
>
> 
> Darren Gamble
> Planner, Regional Services
> Shaw Cablesystems GP
> 630 - 3rd Avenue SW
> Calgary, Alberta, Canada
> T2P 4L4
> (403) 781-4948
>
>
> > -Original Message-
> > From: Crane, Christopher [mailto:[EMAIL PROTECTED]]
> > Sent: Thursday, May 30, 2002 3:07 PM
> > To: '[EMAIL PROTECTED]'
> > Subject: [PHP] Undefined variables
> >
> >
> > I have an annoying problem, that I know is my own ignorance
> > to PHP. I came
> > from PERL and this was not a problem there but is with PHP.
> >
> > Here's the issue.
> > I have a number of scripts that use a "index.php?Task='some
> > sort of task
> > name'", for example, http://www.foo.com/index.php?Task=ShowVersion
> > <http://www.foo.com/index.php?Task=ShowVersion> .  Then I use
> > an if/else
> > statement to tell the script what to do if it sees the
> > ShowVersion variable.
> > In the ShowVersion example, I would call a function that displays the
> > version information I defined in the script. As a back up, I
> > always provide
> > an else statement to catch variables I have no functions for.
> >
> > If I have a ShowVersion function, GetData function and a CreateImage
> > function and the Task variable is empty or a variable that
> > does not exists
> > comes in like http://www.foo.com/index.php?Task=SomethingDumb
> > <http://www.foo.com/index.php?Task=SomethingDumb>  it would go to the
> > default function of something by using the ELSE part of the if/else
> > statements.
> >
> > I hope I am describing this correctly.now here is the
> > problem. If I have
> > warnings turned on, or if I have a log written for warnings,
> > the log fills
> > up if someone goes to http://www.foo.com/index.php
> > <http://www.foo.com/index.php>  or http://www.foo.com
> <http://www.foo.com>
> will error messages like undefine variable TASK on line 255. I understand
> the reason, that PHP was expecting the variable Task when it got to the
> if/else statements. So I put in something like if(!($Task)) { function
> Something(); } but it still is looking for the variable so it still
errors.
>
> In Perl, it would simply be ignored. What do I do here.
>
> Here is a simple example of the code.
>
> if ($Task == "ShowVersion") { function ShowVersion(); }
> elseif ($Task == "GetData") { function GetData(); print "$DataOutput"; }
> elseif ($Task == "CreateImage") { function CreateImage(); }
> else { print "Incorrect Variable or no Variable Supplies"; }
>
>
>
>
>
> Christopher J. Crane
> Network Operations Manager
>
> IKON Office Solutions
> 860.659.6464
>
>



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




Re: [PHP] XML HELP

2002-04-10 Thread Christopher J. Crane

Wow thanks so muchthis was a great help.
"Analysis & Solutions" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hey Christopher:
>
> > function CharacterHandler($Parser, $Line, $StockStuff) {
> >  array_push($StockStuff, $Line);
> >  print "$Line\n";
> >  }
> ... snip ...
> > while ( list(,$Sym) = each($Symbols) ) {
> >  global $StockStuff;
>
> Global is used INSIDE functions to allow variables to be brought in and
> out of the function.  So, in this case, you'd have to put it as the
> first line inside the CharacterHandler function.
>
>
> >  print "1st Position in the array = $StockStuff[1]\n";
> ... snip ...
> > Christopher J. Crane
> > Network Operations Manager
> > IKON Office Solutions
>
> "1" is not the first position in an array.  "0" is. Considering that
> last step there and the signature below, I bet once you get the test
> working, you're just going to grab the array index number that has the
> latest stock quote in it put it on your company's website.
>
> If that's the case, you've got a problem.  What if NASDAQ changes the
> order that the fields are in?  That's right, you'll be putting the wrong
> data on the website.  You need to use an associative array, which means
> the array's index are words, and in this case, the words are the names
> of the data tags.
>
> I just whipped up a complete, basic, example of how to parse XML files
> using PHP.  Lucky for you, it uses your stock quote project as the
> model!  Go check it out:
>
>http://www.analysisandsolutions.com/code/phpxml.htm
>
> Enjoy,
>
> --Dan
>
> --
>PHP classes that make web design easier
> SQL Solution  |   Layout Solution   |  Form Solution
> sqlsolution.info  | layoutsolution.info |  formsolution.info
>  T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
>  4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409



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




[PHP] Re: need help with your code?

2002-04-10 Thread Christopher J. Crane

Ok time out...the problem was simple I had each of the functions one it's
own line because it was simple to see. When I add code to the functions then
I do make it as indicated and easier to read. The problem was that I did not
realize the 80 character columns width. I apologize but did not think it was
everyone's job to critisize. I appreciate the help, I really do. I will be
sure to keep the 80 character width issue in mind when posting.


"Erik Price" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>
> On Tuesday, April 9, 2002, at 11:50  AM, Analysis & Solutions wrote:
>
> > Allow me to nit pick.  That's hard to read.  This, on the other hand, is
> > clearer:
> >function StartHandler($Parser, $ElementName, $Attr='') {
> >   print "$ElementName: ";
> >}
> > Of course, you can do what you want, but then again, you're asking the
> > public to look at your code.  Let alone, using standard indentation
> > makes the code easier for you to understand as well...
>
> If I could just second this statement --
>
> I don't know everything about PHP, but sometimes I can spot a simple
> error like a forgotten "global" statement or something like that.  I
> honestly try to help just about everyone who posts to this list.  I do
> not respond with a help message, however, if either one of two things is
> true:
>
> 1) If I don't know how to help you because I just don't know.
>
> 2) If I can't read the code, or if there is so much of it that it'll
> take twenty minutes just to find the specific problem part.
>
> Usually when I post a request for help, I try to break it down to an
> atomic question.  But sometimes you just can't ask a question because
> you don't even know what to look for, which is fine -- post the relevant
> parts of your code in the body of your message, then post the whole
> script at the end (if it's not too long) so we can see how it fits into
> the big picture if necessary (but usually it's not).
>
> I'm not directing this toward anyone in particular, just a general
> suggestion to everyone who uses this list to make sure that the code is
> easy to read -- this burden should be on the help-requester, not the
> helper.  Yes, this means that some 200 character-long lines will need to
> be reformatted for 80-char column email clients.
>
>
>
>
> Erik
>
>
>
>
> 
>
> Erik Price
> Web Developer Temp
> Media Lab, H.H. Brown
> [EMAIL PROTECTED]
>



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




Re: [PHP] XML HELP

2002-04-08 Thread Christopher J. Crane

ok I tried this at your suggestion
$sym="ikn";
$file =
"http://quotes.nasdaq.com/quote.dll?page=xml&mode=stock&symbol=$sym";;
$StockStuff = array();

function startElement($parser, $name, $attribs) {
print "<$name";
if (sizeof($attribs)) {
while (list($k, $v) = each($attribs)) {
print " $k=\"$v\"";
}
}
print ">";
}

function endElement($parser, $name) {
//print "</$name>";
}

function characterData($parser, $data) {
 print "$data";
// array_push($StockStuff, $data);
}

function PIHandler($parser, $target, $data) {
switch (strtolower($target)) {
case "php":
global $parser_file;
// If the parsed document is "trusted", we say it is safe
// to execute PHP code inside it.  If not, display the code
// instead.
if (trustedFile($parser_file[$parser])) {
eval($data);
} else {
printf("Untrusted PHP code: %s",
htmlspecialchars($data));
}
break;
}
}

function defaultHandler($parser, $data) {
if (substr($data, 0, 1) == "&" && substr($data, -1, 1) == ";") {
printf('%s',
htmlspecialchars($data));
} else {
printf('%s',
htmlspecialchars($data));
}
}

function externalEntityRefHandler($parser, $openEntityNames, $base,
$systemId,
  $publicId) {
if ($systemId) {
if (!list($parser, $fp) = new_xml_parser($systemId)) {
printf("Could not open entity %s at %s\n", $openEntityNames,
   $systemId);
return false;
}
while ($data = fread($fp, 4096)) {
if (!xml_parse($parser, $data, feof($fp))) {
printf("XML error: %s at line %d while parsing entity %s\n",
   xml_error_string(xml_get_error_code($parser)),
   xml_get_current_line_number($parser),
$openEntityNames);
xml_parser_free($parser);
return false;
}
}
xml_parser_free($parser);
return true;
}
return false;
}


function new_xml_parser($file) {
global $parser_file;
 $xml_parser = xml_parser_create();
xml_parser_set_option($xml_parser, XML_OPTION_CASE_FOLDING, 1);
xml_set_element_handler($xml_parser, "startElement", "endElement");
xml_set_character_data_handler($xml_parser, "characterData");
xml_set_processing_instruction_handler($xml_parser, "PIHandler");
xml_set_default_handler($xml_parser, "defaultHandler");
xml_set_external_entity_ref_handler($xml_parser,
"externalEntityRefHandler");

if (!($fp = @fopen($file, "r"))) {
return false;
}
if (!is_array($parser_file)) {
settype($parser_file, "array");
}
$parser_file[$xml_parser] = $file;
return array($xml_parser, $fp);
}

if (!(list($xml_parser, $fp) = new_xml_parser($file))) {
die("could not open XML input");
}

print "";
$Contents = implode( '', file($file) );
   if ( xml_parse($xml_parser, $Contents) ) {
die(sprintf("XML error: %s at line %d\n",
xml_error_string(xml_get_error_code($xml_parser)),
xml_get_current_line_number($xml_parser)));
    }
print "";
xml_parser_free($xml_parser);

print "Array = $StockStuff[0]\n";

and I got an error that read "XML error:  at line 67". I am not sure what
that meant.


"Analysis & Solutions" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> On Mon, Apr 08, 2002 at 06:32:42PM -0400, Christopher J. Crane wrote:
>
> > $file =
> > "http://quotes.nasdaq.com/quote.dll?page=xml&mode=stock&symbol=$sym";;
> ... snip ...
> > while ($data = fread($fp, 4096)) {
> >  if (!xml_parse($xml_parser, $data, feof($fp))) {
> ... snip ...
>
> You've got a whole series of unneded steps and functions.  More
> importantly, you're sending the file to the parser line by line.  You
> need to send the whole file to the parser in one shot.
>
>$Contents = implode( '', file($file) );
>if ( xml_parse($xml_parser, $Contents) ) {
>   # Life is good!
>}
>
> Enjoy,
>
> --Dan
>
> --
>   PHP scripts that make web design easier
> SQL Solution  |   Layout Solution   |  Form Solution
> sqlsolution.info  | layoutsolution.info |  formsolution.info
>  T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
>  4015 7 Ave, Brooklyn NY 11232v: 718-854-0335f: 718-854-0409



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




[PHP] XML HELP

2002-04-08 Thread Christopher J. Crane

I am new to using XML and PHP for that matter. I have made some great
progress with the latter however.
My current problem is that I am trying to parse a relatively simple XML
file. The file can be found at
http://quotes.nasdaq.com/quote.dll?page=xml&mode=stock&symbol=ikn. I used
pieces of a sample file to create the following script:
$sym="ikn";
$file =
"http://quotes.nasdaq.com/quote.dll?page=xml&mode=stock&symbol=$sym";;
$StockStuff = array();

function startElement($parser, $name, $attribs) {
print "<$name";
if (sizeof($attribs)) {
while (list($k, $v) = each($attribs)) {
print " $k=\"$v\"";
}
}
print ">";
}

function endElement($parser, $name) {
//print "";
}

function characterData($parser, $data) {
 print "$data";
The problem lies here ---
///The array is not initializing prior to this statement and I am
not sure how.
array_push($StockStuff, $data);
}

function PIHandler($parser, $target, $data) {
switch (strtolower($target)) {
case "php":
global $parser_file;
// If the parsed document is "trusted", we say it is safe
// to execute PHP code inside it.  If not, display the code
// instead.
if (trustedFile($parser_file[$parser])) {
eval($data);
} else {
printf("Untrusted PHP code: %s",
htmlspecialchars($data));
}
break;
}
}

function defaultHandler($parser, $data) {
if (substr($data, 0, 1) == "&" && substr($data, -1, 1) == ";") {
printf('%s',
htmlspecialchars($data));
} else {
printf('%s',
htmlspecialchars($data));
}
}

function externalEntityRefHandler($parser, $openEntityNames, $base,
$systemId,
  $publicId) {
if ($systemId) {
if (!list($parser, $fp) = new_xml_parser($systemId)) {
printf("Could not open entity %s at %s\n", $openEntityNames,
   $systemId);
return false;
}
while ($data = fread($fp, 4096)) {
if (!xml_parse($parser, $data, feof($fp))) {
printf("XML error: %s at line %d while parsing entity %s\n",
   xml_error_string(xml_get_error_code($parser)),
   xml_get_current_line_number($parser),
$openEntityNames);
xml_parser_free($parser);
return false;
}
}
xml_parser_free($parser);
return true;
}
return false;
}


function new_xml_parser($file) {
global $parser_file;
 $xml_parser = xml_parser_create();
xml_parser_set_option($xml_parser, XML_OPTION_CASE_FOLDING, 1);
xml_set_element_handler($xml_parser, "startElement", "endElement");
xml_set_character_data_handler($xml_parser, "characterData");
xml_set_processing_instruction_handler($xml_parser, "PIHandler");
xml_set_default_handler($xml_parser, "defaultHandler");
xml_set_external_entity_ref_handler($xml_parser,
"externalEntityRefHandler");

if (!($fp = @fopen($file, "r"))) {
return false;
}
if (!is_array($parser_file)) {
settype($parser_file, "array");
}
$parser_file[$xml_parser] = $file;
return array($xml_parser, $fp);
}

if (!(list($xml_parser, $fp) = new_xml_parser($file))) {
die("could not open XML input");
}

print "";
while ($data = fread($fp, 4096)) {
 if (!xml_parse($xml_parser, $data, feof($fp))) {
die(sprintf("XML error: %s at line %d\n",
xml_error_string(xml_get_error_code($xml_parser)),
xml_get_current_line_number($xml_parser)));
}
}
print "";
xml_parser_free($xml_parser);

print "Array = $StockStuff[0]\n";

Ok so the problem is that I get an error telling me I have to create the
array first. If you can't tell, what I am trying to do is push the $data
part of the XML file into an array. There is probable 100+ better ways to do
this, but I can't figure how to get the information I want. I just wanted a
simple, very simple, stock retrieval piece of script. Everything I see is
too long and complex. So I thought I would simply parse this XML file. Benn
at it for two days now. I can easily get a CSV string from YAHOO.COm, but I
am not sure how to get that into an array either.

Any help here would be great. Either completely parsing the file or some way
of pushing the $data into the array $StockStuff




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




[PHP] HELP!! New PHP not working

2002-03-23 Thread Christopher J. Crane

I just downloaded the new version of PHP. I installed it and I am using
Omnicron HTTPD server version 2.09. The PHP that came with the server works,
but when I installed the new version of PHP from PHP.NET, I got the
following error.

[PHP] OMNICRON Problems

2002-03-21 Thread Christopher J. Crane

I just downloaded PHP from PHP.net and it's the newest version.
I can not get it to work. I get the "Security Alert! PHP CGI cannot be
accessed directly" message.
I have edited the php.ini file and changed the "cgi.force_redirect" to "0"
and back to "1" and everything else I could think of. I restarted the server
each time, but never got it to work. Has anyone else had any luck with this?



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




[PHP] Displaying SELECT results

2002-03-21 Thread Christopher J. Crane

I wrote a shopping cart, but I
don't understand two things.
1) What is the best way to display like the first ten records and then a
list of how many pages with 10 records on them...similar to like a search
engine when it returns it's results. If I have 100 items I do not want to
display all of them on one page. So I will display the first ten, and then a
link for the next ten or something like that. I did this in PERL, but it was
a long mathematical routine to get it and I know there must be an easier
way.

2) To display the results of a SELECT statement, but every other line is a
off color. So Like row 1 is white and row 2 is gray and row 3 is white and
row 4 is gray and so one.




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




[PHP] HELP UNIX vs Windows

2002-03-06 Thread Christopher J. Crane

I am a PERL scripter and I am just getting into PHP. My first few pages are
simple but I am running into a few problems when changing OS. I included
below a piece of code that works fine in windows but not on a linux box. Not
sure what the differences would be

The problem is that on the windows platform all information is returned. On
the linux platform the "$Details" variable is not populated. The nothing
changes...so what could it be. The only thing I can think of is that maybe
the version of php is different on the linux server.

Here is the code.after reading in a file with "|" deliminations
while ($i < $length):
   $tok = strtok($cartFile[$i],"|");
$Category = $tok;   $tok = strtok("|");
$SKU = $tok;$tok = strtok("|");
$Name = $tok;$tok = strtok("|");
$SubCategory = $tok;  $tok = strtok("|");
$Price = $tok;$tok = strtok("|");
$Image1 = $tok;$tok = strtok("|");
$Image2 = $tok;$tok = strtok("|");
$OnSale = $tok;$tok = strtok("|");
$SalePrice = $tok;   $tok = strtok("|");
$Details = $tok;   $tok = strtok("|");

   if($MCat == "$Category") {
$Count++;
if($OnSale == "1") { $Price = "$$Price On
Sale Now! $$SalePrice"; }

displayProd($Category,$SKU,$Name,$SubCategory,$Price,$Image1,$Image2,$OnSale
,$SalePrice,$Details);
   }
  $i++;
  endwhile;



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