php-windows Digest 4 Sep 2003 04:32:30 -0000 Issue 1899
Topics (messages 21311 through 21317):
Cant get maths functions to work in class file
21311 by: Mark Harrington
21312 by: Mark Harrington
21313 by: Ignatius Reilly
$PHP_SELF
21314 by: Mark Harrington
21317 by: Dean Hayes
Re: download function
21315 by: DvDmanDT
Re: stuck with substr now .......
21316 by: DvDmanDT
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
[EMAIL PROTECTED]
----------------------------------------------------------------------
--- Begin Message ---
I have designed a class that multiplies one of the varibles by two but when
i pass the values to the contructor i cant get the answer out any ideas
Here is the full script "If you can recognise the problem can you explain
why its wrong and why its not working "Ps learning the langauge "
The Class File
class purchase {
var $PartNumber;
var $Description;
var $Unitprice ;
// this is the constuctor
function purchase($partnumber,$desc,$price)
{
$this->PartNumber = $partnumber;
$this->Description =$desc;
$this->Unitprice =$price;
echo "Object created partNumber = $this->PartNumber <br>";
echo " This Objects Description = $this->Description <br>";
echo " This Objects Price is $this->Unitprice <BR>";
//this doesnt work why ??
echo " price * two is $this->Unitprice*2<BR>";
}// end constructor
}
$myObject = new purchase(1,"Speaker",23.00);
?>
[EMAIL PROTECTED]
--- End Message ---
--- Begin Message ---
I have designed a class that multiplies one of the varibles by two but when
i pass the values to the contructor i cant get the answer out any ideas
Here is the full script "If you can recognise the problem can you explain
why its wrong and why its not working "Ps learning the langauge "
The Class File
class purchase {
var $PartNumber;
var $Description;
var $Unitprice ;
// this is the constuctor
function purchase($partnumber,$desc,$price)
{
$this->PartNumber = $partnumber;
$this->Description =$desc;
$this->Unitprice =$price;
echo "Object created partNumber = $this->PartNumber <br>";
echo " This Objects Description = $this->Description <br>";
echo " This Objects Price is $this->Unitprice <BR>";
//this doesnt work why ??
echo " price * two is $this->Unitprice*2<BR>";
}// end constructor
}
$myObject = new purchase(1,"Speaker",23.00);
?>
[EMAIL PROTECTED]
--- End Message ---
--- Begin Message ---
echo() can interpolate a variable, but not an expression such as
"$this->Unitprice*2"
replace:
echo " price * two is $this->Unitprice*2<BR>";
by:
$bytwo = $this->Unitprice*2 ;
echo " price * two is $bytwo<BR>";
HTH
Ignatius
_________________________
----- Original Message -----
From: "Mark Harrington" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, September 03, 2003 4:54 PM
Subject: [PHP-WIN] Cant get maths functions to work in class file
> I have designed a class that multiplies one of the varibles by two but
when
> i pass the values to the contructor i cant get the answer out any ideas
>
> Here is the full script "If you can recognise the problem can you explain
> why its wrong and why its not working "Ps learning the langauge "
>
> The Class File
>
> class purchase {
>
> var $PartNumber;
> var $Description;
> var $Unitprice ;
>
>
> // this is the constuctor
>
> function purchase($partnumber,$desc,$price)
> {
> $this->PartNumber = $partnumber;
> $this->Description =$desc;
> $this->Unitprice =$price;
> echo "Object created partNumber = $this->PartNumber <br>";
> echo " This Objects Description = $this->Description <br>";
> echo " This Objects Price is $this->Unitprice <BR>";
> //this doesnt work why ??
> echo " price * two is $this->Unitprice*2<BR>";
> }// end constructor
>
>
> }
>
>
> $myObject = new purchase(1,"Speaker",23.00);
>
> ?>
>
>
> [EMAIL PROTECTED]
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--- End Message ---
--- Begin Message ---
Sorry about this question "Im a novice at this "
Ok read all the info on this special variable but i still havent got a clue
what they are on about "Duh" yeah i know but if someone can put this into
plain english for me it would be helpfull
1: What does it do i see this included in forms for submission of values
acording to one tut it does the following but im still perplexed by this
As follows
Also note the use of the variable $PHP_SELF. This variable, which stores the
script's name and location, is passed along with every PHP page. It's
helpful here because we just want this file to call itself. Using $PHP_SELF,
we can be sure that will happen, even if the file is moved to another
directory - or even another machine.
2: Where would i use this and why would I use this. Whats its purpose can
any one give me an explained example " may be an algorithm or something "
>From what I understand is that if you use this on one php script then
calling another script with the variable $PHP_SELF contained within will
remember the previous script " <<< Now im really confused !!
Manythanks Mark
[EMAIL PROTECTED]
"Having to teach myself due to cost of university fees in the UK " Excuse
mysarcasm "Chucle chuckle " I know its a bit dry
--- End Message ---
--- Begin Message ---
hey,
i use the var $PHP_SELF in a news board i have just finished. What i use it
for is some people rename it from news.php to something like latest_news.php
or anything else they want so in a form i use it like this
<FORM METHOD="Post" ACTION="<?Php echo $PHP_SELF; ?>?area=submit">
that will then print the following into the page code
<FORM METHOD="Post" ACTION="news.php?area=submit">
The $PHP_SELF is just a shortcut instead of writting the name into the
script it will get the full url of the script and the name an put it in for
you.
If i move a script from one dir on my computer say http://127.0.0.1/news/ to
http://127.0.0.1/new_news/ the $PHP_SELF will change from /news/ to
/new_news/ every time the script is called.
If you need help on any php var download a copy of the Php Man located on
the PHP.net site it comes in handy for things like this.
Dean "The Insane Guy" Hayes
Mystical Web Designs
http://www.mystical-sector.com
<-- I design and i redesign but still i never designed true beauty like you
-->
From: "Mark Harrington" <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Subject: [PHP-WIN] $PHP_SELF
Date: Wed, 3 Sep 2003 18:39:19 +0100
Sorry about this question "Im a novice at this "
Ok read all the info on this special variable but i still havent got a clue
what they are on about "Duh" yeah i know but if someone can put this into
plain english for me it would be helpfull
1: What does it do i see this included in forms for submission of values
acording to one tut it does the following but im still perplexed by this
As follows
Also note the use of the variable $PHP_SELF. This variable, which stores the
script's name and location, is passed along with every PHP page. It's
helpful here because we just want this file to call itself. Using $PHP_SELF,
we can be sure that will happen, even if the file is moved to another
directory - or even another machine.
2: Where would i use this and why would I use this. Whats its purpose can
any one give me an explained example " may be an algorithm or something "
From what I understand is that if you use this on one php script then
calling another script with the variable $PHP_SELF contained within will
remember the previous script " <<< Now im really confused !!
Manythanks Mark
[EMAIL PROTECTED]
"Having to teach myself due to cost of university fees in the UK " Excuse
mysarcasm "Chucle chuckle " I know its a bit dry
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
_________________________________________________________________
Protect your inbox from harmful viruses with new ninemsn Premium. Click here
http://ninemsn.com.au/premium/landing.asp
--- End Message ---
--- Begin Message ---
Would you mind sharing that solution with us? I'm kinda intrested in that...
--
// DvDmanDT
MSN: [EMAIL PROTECTED]
Mail: [EMAIL PROTECTED]
"Ignatius Reilly" <[EMAIL PROTECTED]> skrev i meddelandet
news:[EMAIL PROTECTED]
> I found the solution to my problem.
>
> Sorry
>
> Ignatius
> _________________________
> ----- Original Message -----
> From: "Ignatius Reilly" <[EMAIL PROTECTED]>
> To: "Win32 list PHP" <[EMAIL PROTECTED]>
> Sent: Saturday, August 30, 2003 1:19 PM
> Subject: [PHP-WIN] download function
>
>
> > Hello,
> >
> > I have the following problem:
> >
> > I want users to download content that is stored in a private directory,
as
> a
> > downloadable file.
> > So I do:
> >
> > <code>
> > header( "Content-type: octet/stream" ) ;
> > header( "Content-Length: ".filesize( $file_path ) ) ;
> > header( "Content-Disposition: attachment; filename={$filename}" ) ;
> > header( "Content-transfer-encoding: binary" ) ;
> > echo "\n" ;
> > readfile( $file_path ) ;
> > </code>
> >
> > Everything works just fine, except that the main IE (5.5) windows
> underneath
> > the download box shows a "The page cannot be displayed" error, which I
> would
> > just as well replace by
> > my own content.
> >
> > How can I do?
> > Thanks
> >
> > Ignatius
> >
> > --
> > PHP Windows Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
--- End Message ---
--- Begin Message ---
Are you sure you mean /r/n? I think you mean \r\n which is a windows
line-end..
--
// DvDmanDT
MSN: [EMAIL PROTECTED]
Mail: [EMAIL PROTECTED]
"Toby z" <[EMAIL PROTECTED]> skrev i meddelandet
news:[EMAIL PROTECTED]
> hay guyz
>
> im stuck with substr now
>
> im sure i ve actually lost it ....
>
> i have a string being passed to a graph as its title
> and the title is being retrieved from mysql db
>
> now whenever i store anything with <br> or /r/n
> its displayed normally on the screen
>
> but this time i have to pass this to a jpeg chart being created by jd
> library
> which is then displayed on the screen
>
> and the title gets displayed as
>
> Medicine Reports /r/n (report generated for below 60% stocked
> medicines)
>
> where its supposed to display
>
> Medicine Reports
> (report generated for below 60% stocked medicines)
>
>
> i have tried a few functions but none of them seem to be working
>
> i can, however pass two strings as title and sub-title to the graph
> function call
>
> and for this i need to splitt the title retrieved from db to two
> strings ......
>
>
>
> =================================================================
>
>
> <?php
>
>
>
> //$pg='rprt_gf_py_3d_1';
> // ma dta
>
> $max_data = count($gfData);
>
> for ($k = 0; $k < $max_data; $k++)
> {
> //$arrData[$k] = $gfData[$k] * $factor ;
> $data[$k] = $gfData[$k] ;
> }
>
>
>
>
> // Create the Pie Graph.
> $graph = new PieGraph(850,600,"auto");
> $graph->SetShadow();
>
>
>
> /*************************
> trying 2 split title :P:P:P ! ! ! !
> **************************/
>
>
> $newStr="";
> //Replacing \n with <br>
> /*$tok = strtok($title,":P");
> while ($tok) {
> $newStr = $newStr.$tok."<br>";
> $tok = strtok(":P");
> }
> */
> $tok = split($title,":P");
> //while ($tok) {
> $newStr = $newStr.$tok."<br>";
> //$tok = substr(":P");
> //}
>
> echo ($newStr);
>
>
> //$newStr = explode("\r\n","$title");
> //$newStr = explode(chr(10),"$title");
> //$newStr = preg_split("/[ \t]+/", $title);
>
>
>
>
>
>
> // Set A title for the plot
> $graph->title->Set("$newStr");
> $graph->subtitle->Set("sub");
> $graph->title->SetFont(FF_VERDANA,FS_BOLD,18);
> $graph->title->SetColor("darkblue");
> $graph->legend->Pos(0.1,0.2);
>
> // Create 3D pie plot
> $p1 = new PiePlot3d($data);
> $p1->SetTheme("sand");
> $p1->SetCenter(0.4);
> $p1->SetSize(150);
>
> // Adjust projection angle
> $p1->SetAngle(45);
>
> // Adjsut angle for first slice
> $p1->SetStartAngle(45);
>
> // Display the slice values
> $p1->value->SetFont(FF_ARIAL,FS_BOLD,11);
> $p1->value->SetColor("navy");
>
> // Add colored edges to the 3D pie
> // NOTE: You can't have exploded slices with edges!
> $p1->SetEdge("navy");
>
>
> for ($i = 0; $i < $max_data; $i++)
> {
> if ($arrData[$i] > $max_value)
> $max_value = $arrData[$i];
>
> if ( strlen($label[$i]) > $max_label_width )
> $max_label_width = strlen($label[$i]);
>
> $p1->SetLegends($label);
>
> $ttl_rkrdz = array_sum($gfData);
> }
>
>
> $graph->Add($p1);
> $graph->Stroke("abc.jpg");
>
> echo("
> <table width='100%' border='1'>
> <tr> <td align='right'>
> <img src=abc.jpg>
> </td> </tr>
> </table>
>
> <br><br><br>
> ");
>
>
>
> $table_text = "<table align=center border='0'><tr><td
> align='center'> </td></tr>
>
> <tr><td align=center></td></tr><tr><td align=center ><br><table
> border=4><tr>";
>
>
>
> for ($i = 0; $i < $max_data; $i++)
> {
> if ($arrData[$i] > $max_value)
> $max_value = $arrData[$i];
>
> if ( strlen($label[$i]) > $max_label_width )
> $max_label_width = strlen($label[$i]);
>
> $table_text = $table_text . "<th> " . $label[$i] . " </th>";
> $ttl_rkrdz = array_sum($gfData);
>
> }
> $table_text = $table_text . "</tr>";
> $table_text = $table_text . "<tr>";
>
>
> for ($i = 0; $i < $max_data; $i++)
> {
>
> $table_text = $table_text . "<td style= \"font-family: $font\" >" .
> $gfData[$i] . "</td>";
>
>
> }
> $table_text = $table_text . "</tr>
> </table></td></tr>
> <tr>
> <td style= \"font-family: $font\"> </td>
> </tr>
> <tr><td> </td></tr>
>
> <tr> <td>
> <table border='4' align=center>
> <tr>
> <th width='50%' valign='center' style= \"font-family: $font\">
> Total Records </th>
> <td width='50%' valign='center' style= \"font-family: $font\">
> $ttl_rkrdz </td>
> </tr>
> </table>
> </td>
> </tr>
> <tr><td> </td></tr>
> <tr><td> </td></tr>
> <tr><td> </td></tr>
> ";
>
> echo($table_text);
>
> ?>
>
>
> =============================================================
>
>
> will someone plz jerk me out of this ..... ?????
>
> thnx a million
>
> toby
>
> ________________________________________________________________________
> Want to chat instantly with your online friends? Get the FREE Yahoo!
> Messenger http://uk.messenger.yahoo.com/
--- End Message ---