Re: [PHP] passing return value from fucntion

2005-03-18 Thread Forest Liu
I donot understand your problem clearly yet.
I think there must be a caller and a callee (called function) when we
talking about "passing arguments". That is to say, you write in your
main program:

...
echo calc($rs)."";
...

and make sure there is a function named "calc":

function calc($rightsid){
...
if(...){
} elseif ($rightsid == $oik6) {
  $res = ok;
  return $res;
} elseif ($rightsid == $oik7) {
  $res = notok;
  return $res;
}
...
}

then the result calculated in the function would be passed to the
point you calling in your main program.

Certainly,"ok" and "notok", I think they should be boolean, as "true"
and "false". If you really write your code like that exactly, the two
words "ok" and "notok" wont have any effective meaning.

wish it helps to you.

On Fri, 18 Mar 2005 09:33:13 +0200, William Stokes <[EMAIL PROTECTED]> wrote:
> Hello,
> Just simple question (I think?)
> 
> How to pass return value from function to the main program?
> 
> Here's example:
> do some code in funtion to set the $res value:
> 
> } elseif ($rightsid == $oik6) {
>   $res = ok;
>   return $res;
> } elseif ($rightsid == $oik7) {
>   $res = notok;
>   return $res;
> }
> 
> How can I get to use the  $res in the main program. The return $res; doesn't
> pass the variable to the main program right?
> 
> Thanks
> -Will
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 


-- 
   Sincerely,
 Forest Liu(åäè)

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



Re: [PHP] passing return value from fucntion

2005-03-18 Thread Forest Liu
No...I think it is not a proper way to program.If you have programming
experiences with  any other language, you'll understand this
naturally.
The original purpose of making a function is tell it some arguments,
and you get a result. It should have the fewest relationship with the
environment which, just like "a global variable" for instance, outside
of it.
So, we should understand the relation between caller and callee(I make
this word) as your main program as your function.

...
 echo calc($rs)."";//at this point,the function will work,and give a result.
 ...
 
//a function named "calc":
 
 function calc($rightsid){
 ...
 if(...){
 } elseif ($rightsid == $oik6) {
  $res = ok;
  return $res;
 } elseif ($rightsid == $oik7) {
  $res = notok;
  return $res;
 }
 ...
 }



On Fri, 18 Mar 2005 10:43:30 +0200, William Stokes <[EMAIL PROTECTED]> wrote:
> Never mind I got it figured out. Had to set a global variable to make it
> visible.
> Thanks anyway
> 
> -Will
> 
> "Forest Liu" <[EMAIL PROTECTED]> kirjoitti
> viestissÃ:[EMAIL PROTECTED]
> I donot understand your problem clearly yet.
> I think there must be a caller and a callee (called function) when we
> talking about "passing arguments". That is to say, you write in your
> main program:
> 
> ...
> echo calc($rs)."";
> ...
> 
> and make sure there is a function named "calc":
> 
> function calc($rightsid){
> ...
> if(...){
> } elseif ($rightsid == $oik6) {
>  $res = ok;
>  return $res;
> } elseif ($rightsid == $oik7) {
>  $res = notok;
>  return $res;
> }
> ...
> }
> 
> then the result calculated in the function would be passed to the
> point you calling in your main program.
> 
> Certainly,"ok" and "notok", I think they should be boolean, as "true"
> and "false". If you really write your code like that exactly, the two
> words "ok" and "notok" wont have any effective meaning.
> 
> wish it helps to you.
> 
> On Fri, 18 Mar 2005 09:33:13 +0200, William Stokes <[EMAIL PROTECTED]>
> wrote:
> > Hello,
> > Just simple question (I think?)
> >
> > How to pass return value from function to the main program?
> >
> > Here's example:
> > do some code in funtion to set the $res value:
> >
> > } elseif ($rightsid == $oik6) {
> >   $res = ok;
> >   return $res;
> > } elseif ($rightsid == $oik7) {
> >   $res = notok;
> >   return $res;
> > }
> >
> > How can I get to use the  $res in the main program. The return $res;
> > doesn't
> > pass the variable to the main program right?
> >
> > Thanks
> > -Will
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> 
> --
>   Sincerely,
> Forest Liu(???)
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 


-- 
 Sincerely,
   Forest Liu(åäè)

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



Re: [PHP] How from an html/web form I may go to a php script output(of form values)

2005-03-18 Thread Forest Liu
I donot know what happened in Frontpage. I just use Dreamweaver to
design the page layout, and then UltraEdit to add php code.

I think you are asking about the page submit. You can find the exact
example in the php manual, which can be obtained from php.net

a.php:

  
  


b.php:
echo "your input just now is:".$_POST[usrinfo];

it will work.

On Fri, 18 Mar 2005 10:38:45 +0200, Leonidas Savvides
<[EMAIL PROTECTED]> wrote:
> How from an html/web form I may go to a php script output(of form
> values) ? I mean the programming for the result :
> 
> A visitor to webpage-A.php when press submit of a webform go to a
> webpage-B.php where as a php script uses the previous form data , and
> for example there's output of these data the exactly words the visitor
> enters ?
> 
> May this done in MS-FrontPage2002 ?
> 
> THE SCRIPT IN MS-FrontPage2002 HTML MODE NO EXECUTED BUT IS LIKE NO
> EXIST , UNLIKE THE CODE HAS ALREADY SCRIPT COLOR IN HTML MODE OF
> FRONTPAGE AND ALSO PHP SCRIPT FILE NAME xxx.php IS IN THE WEB FORM
> PROPERTIES ? ... I INSERT PHP SCRIPT IN  .  TAGS ?
> AND ALSO I TRY DELETE PHP SCRIPT INSERTING ONLY ONE COMMAND THE:
> 
> echo "this operate till here";
> 
> BUT AGAIN THE SAME RESULT  ?
> After press SUBMIT the php script file shows in address bar and all
> viewed area is white (nothing on screen) ?
> 
> Leonidas Savvides
> [EMAIL PROTECTED]
> 
> 


-- 
  Sincerely,
Forest Liu(åäè)

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



Re: [PHP] build an array of checkbox

2005-03-18 Thread Forest Liu
I guess you have the experiences with VB development, right? :)
I think it is not a problem in php, because the index of an array in
php can be a string. That is the solution.You can name the checkboxes
in a certain sequence in your html doc.Then use array to judge in php,
such as foreach.
wish helps.

On Fri, 18 Mar 2005 12:31:40 -0800, TomÃs Rodriguez Orta
<[EMAIL PROTECTED]> wrote:
> Hello people.
> 
> I have a doubt, I want to build an array of checkbox, why?
> well because I list a recordset from data base, and I want to delete the
> current record  when the check is selected by the click mouse.
> for example the editor of mail.yahoo.xx, that  you can delete any mail when
> you selected any checkbox.
> 
> somebody help me, please.
> 
> sincerely TOMAS
> 
> -
> Este correo fue escaneado en busca de virus con el MDaemon Antivirus 2.27
> en el dominio de correo angerona.cult.cu  y no se encontro ninguna 
> coincidencia.
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 


-- 
  Sincerely,
Forest Liu(åäè)

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



Re: [PHP] XML & HTTP

2005-03-18 Thread Forest Liu
I suppose Jerry was talking about the possibilities, just like the
ways you listed.
And, perhaps Jerry have his own two servers, and wanna build a whole
system in which the servers communicate with ach other via xml doc. In
this case, I think SOAP is a better way for Jerry.


On Fri, 18 Mar 2005 16:03:20 -0500, Jason Barnett
<[EMAIL PROTECTED]> wrote:
> Chris Shiflett wrote:
> > Jerry Swanson wrote:
> >
> >> I generated XML file. I need to send the file to another server not
> >> through FTP but though HTTP.
> >
> >
> > Yes, I gathered that, but you're not telling us how you're supposed to
> > send it. For example, when Google first provided their web API, they
> > didn't say, "just send us an XML document." :-)
> >
> > There are many details you're not giving us (you can leave out the
> > details involving the XML document itself, of course), so it's pretty
> > much impossible to even guess an answer to your question.
> >
> > Chris
> >
> 
> Seriously... Chris is truly trying to help you.  There are many, many
> ways to send an XML file.  The following are HTTP methods off of the top
> of my head:
> 
> SOAP (possibly with WSDL)
> Simple HTTP POST (usually through a form)
> Simple HTTP GET (possibly through a form, though passing XML documents
> through URL parameters is probably not "A Good Thing".)
> 
> It really depends on what the *receiving server* expects.  Is there a
> documented API?  Or perhaps can you just point us to the page (URL) that
> is supposed to receive the XML document?
> 
> --
> Teach a man to fish...
> 
> NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
> STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
> STFM | http://php.net/manual/en/index.php
> STFW | http://www.google.com/search?q=php
> LAZY |
> http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins
> 
> 
> 


-- 
   Sincerely,
 Forest Liu(åäè)

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



Re: [PHP] Problem calling function within a class

2005-03-18 Thread Forest Liu
it shuold be:

$SQL_Query = "INSERT INTO ".$this->Company_Referrer_Table." ( Record_ID
, Record_Data ) VALUES ( '', '".$this->Record_Data."')";

just use the operator '.' to connect two string. I think php could
only identify simple car direcctly as $foo to be its value in a string
contain it. The reference to a class data member would not work well
in a string. So you should use the operator '.' to connect them.

On Sat, 19 Mar 2005 02:43:15 +0200, Ahmed Abdel-Aliem <[EMAIL PROTECTED]> wrote:
> hi
> 
> i am new to classes and i have a problem with a class i wrote
> 
> here is the class
> 
> ---
> class Company {
> 
>var $Company_Name;
>var $Company_Referrer_Table;
>var $Company_Visitor_Table;
>var $Company_ID;
>var $Message;
>var $File;
>var $FileName;
>var $Record_Data;
> 
>function CompanyInfo (){
> 
>$SQL_Query = mysql_query("SELECT * FROM company_list WHERE
> Company_ID = $this->Company_ID");
>$Record = mysql_fetch_array($SQL_Query);
> 
>$this->Company_ID = $Record['Company_ID'];
>$this->Company_Name = $Record['Company_Name'];
>$this->Company_Referrer_Table = 
> $Record['Company_Referrer_Table'];
>$this->Company_Visitor_Table = 
> $Record['Company_Visitor_Table'];
> 
>return $this->Company_Referrer_Table;
>return $this->Company_Visitor_Table;
> 
>}
> 
>function GenerateUniqueID(){
> 
>return md5(uniqid(mt_rand(),TRUE));
> 
>}
> 
>function UploadFile($File) {
> 
>$this->File = $File;
>$dst_file_name = $this->GenerateUniqueID();
>$arr = split("\.",$this->File['name']);
>$this->File['name'] = $dst_file_name;
>$this->File['name'] .= ".".$arr[count($arr)-1];
>$dest_dir = 'temp';
>$dest = $dest_dir . '/' .$this->File['name'];
>$r = move_uploaded_file($this->File['tmp_name'], $dest);
>$this->FileName = $this->File['name'];
>chmod("temp/".$this->FileName, 777);
> 
>}
> 
>function TakeData($File, $Company_ID, $Destination) {
> 
>$this->Company_ID = $Company_ID;
> 
>$this->CompanyInfo();
> 
>if ($Destination == "Referrer"){
> 
>$SQL_Query = "INSERT INTO 
> $this->Company_Referrer_Table ( Record_ID
> , Record_Data ) VALUES ( '', '$this->Record_Data')";
> 
>}elseif ($Destination == "Visitor"){
> 
>$SQL_Query = "INSERT INTO $this->Company_Visitor_Table 
> ( Record_ID
> , Record_Data ) VALUES ( '', '$this->Record_Data')";
> 
>}
> 
>$this->UploadFile($File);
> 
>$fh = fopen("temp/".$this->FileName, "r");
>while (! feof($fh)) : $this->Record_Data = fgets($fh, 4096);
>mysql_query($SQL_Query)or die("Error In Importing Records To 
> The Database");
>endwhile;
>fclose($fh);
> 
>$this->Message = "Date Imported Successfully";
>return $this->Message;
> 
>}
> 
> }
> 
> ---
> 
> the problem occurs when i call the function TakeDate
> 
> i use this code to call it
> 
> $Company = new Company();
> $File =& $HTTP_POST_FILES['FileToUpload'];
> $Company->TakeData($File, $Company_ID, $Destination);
> $Message = $Company->Message;
> 
> the error i get is "Error In Importing Records To The Database" which
> i defined as the error of mysql in the function.
> 
> i checked everything and found that the problem happens because i
> can't retireve the values of
> $this->Company_Referrer_Table and $this->Company_Visitor_Table by
> calling the function CompanyInfo
> from the function TakeData
> 
> can anyone advise me with the right way to call the CompanyInfo
> function from the TakeData and get the values correctly?
> 
> --
> Ahmed Abdel-Aliem
> Web Developer
> www.ApexScript.com
> 0101108551
> registered Linux user number 382789
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 


-- 
   Sincerely,
 Forest Liu(åäè)

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



Re: [PHP] How from an html/web form I may go to a php script output(of form values)

2005-03-19 Thread Forest Liu
I am so sorry for my misunderstanding and leading you to anger. But I
am still not so clear yet...about your demand.

I guess you wanna say, a visitor enter his account and password, and
click 'submit', then the browser navigates to b.php to check if all
are correct. Right?

a.php:





b.php:


it will really work.I promise.

First, make sure your script tag is , that's the default
tag for interpreter.
Secondly, HTML page is just a plain text file. You can just use
Notepad to edit it. It's not about Frontpage or Deamweaver, It's about
HTML code. Whichever tool you are using, they all generate a plain
text file named "*.html" on your HDD. Then you should upload them to a
web host space.And , they run on the server side.


On Sat, 19 Mar 2005 17:03:19 +0200, Leonidas Savvides
<[EMAIL PROTECTED]> wrote:
> If is easy please answer and this : when be online AND OPEN A FILE FROM
> A WEB LOCATION HOST - MINE WITH NOTEPAD may after I modify it, save it
> again to my hosting space WITHOUT save it to my PC first ? Please note
> that I mean using NotePad and I mean entering the host username&password
> when OPEN / SAVE ...? ATTENTION: I DO NOT MEAN SAVE IT TO MY HDD FIRST
> AND AFTER UPLOAD IT !!! Please tell me the same[as for NotePad] but for
> Dreamweaver MX ?
> [EMAIL PROTECTED]
> -Original Message-
> From: Forest Liu [mailto:[EMAIL PROTECTED]
> Sent: 18 March 2005 11:51
> To: Leonidas Savvides
> Cc: php-general@lists.php.net; [EMAIL PROTECTED]; sony-only;
> [EMAIL PROTECTED]
> Subject: Re: [PHP] How from an html/web form I may go to a php script
> output(of form values)
> 
> I donot know what happened in Frontpage. I just use Dreamweaver to
> design the page layout, and then UltraEdit to add php code.
> 
> I think you are asking about the page submit. You can find the exact
> example in the php manual, which can be obtained from php.net
> 
> a.php:
> 
>  
>  
> 
> 
> b.php:
> echo "your input just now is:".$_POST[usrinfo];
> 
> it will work.
> 
> On Fri, 18 Mar 2005 10:38:45 +0200, Leonidas Savvides
> <[EMAIL PROTECTED]> wrote:
> > How from an html/web form I may go to a php script output(of form
> > values) ? I mean the programming for the result :
> >
> > A visitor to webpage-A.php when press submit of a webform go to a
> > webpage-B.php where as a php script uses the previous form data , and
> > for example there's output of these data the exactly words the visitor
> > enters ?
> >
> > May this done in MS-FrontPage2002 ?
> >
> > THE SCRIPT IN MS-FrontPage2002 HTML MODE NO EXECUTED BUT IS LIKE NO
> > EXIST , UNLIKE THE CODE HAS ALREADY SCRIPT COLOR IN HTML MODE OF
> > FRONTPAGE AND ALSO PHP SCRIPT FILE NAME xxx.php IS IN THE WEB FORM
> > PROPERTIES ? ... I INSERT PHP SCRIPT IN  .  TAGS
> ?
> > AND ALSO I TRY DELETE PHP SCRIPT INSERTING ONLY ONE COMMAND THE:
> > 
> > echo "this operate till here";
> > 
> > BUT AGAIN THE SAME RESULT .... ?
> > After press SUBMIT the php script file shows in address bar and all
> > viewed area is white (nothing on screen) ?
> >
> > Leonidas Savvides
> > [EMAIL PROTECTED]
> >
> >
> 
> --
>  Sincerely,
>Forest Liu(åäè)
> 
> 


-- 
  Sincerely,
Forest Liu(åäè)

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



Re: [PHP] php-not-executing-in-html-file-help-----its working----thanks

2005-03-20 Thread Forest Liu
Two ways to resolve it:
1,simplest, rename your file as xxx.php, in order to let php
interpreter to process the script.
2, as just now others saying, add file type 'html' to the list which
interpreter would process.


On Sun, 20 Mar 2005 17:43:52 -0800 (PST), vijayaraj nagarajan
<[EMAIL PROTECTED]> wrote:
> hi
> ian, chris , stephan and others
> 
> its working..now...
> i dont know how come...but its working...
> thank you somuch...
> 
> vijay
> 
> --- Ian Firla <[EMAIL PROTECTED]> wrote:
> >
> > You need to tell apache to run html files through
> > the php interpreter:
> >
> > ie. AddType application/x-httpd-php .php .php3 .html
> >
> > then restart apache
> >
> > Ian
> >
> > On Sun, 2005-03-20 at 14:12 -0800, vijayaraj
> > nagarajan wrote:
> > > hi friends
> > > i am struggling to solve this problem for the past
> > one
> > > week...kindly help me..
> > >
> > > my apache runs perfectly...
> > > this code gives a perfect output in the browser...
> > >
> > > file name: hi.html
> > >
> > > 
> > > hihihi
> > > 
> > >
> > > but this code doesnot give any output in the
> > > browser...
> > >
> > > file name: hi.html
> > >
> > > 
> > > 
> > > 
> > >
> > > but, the same file with the php code in it...could
> > be
> > > executed in the command line, using php... where i
> > am
> > > getting the expected output...
> > >
> > > i tested to c if my apache doesnt recognise php
> > ...
> > >
> > > this code runs perfectly...in the browser...
> > >
> > > 
> > >
> > > if saved as hi.php file...
> > > the same code saved as .html, is not giving any
> > output
> > > in the browser...
> > >
> > > kindly help me to figure out this problem...
> > >
> > > thanks
> > >
> > > vijayaraj nagarajan
> > > graduate student
> > > the university of southern mississippi
> > > MS - USA
> > >
> > >
> > >
> > > __
> > > Do You Yahoo!?
> > > Tired of spam?  Yahoo! Mail has the best spam
> > protection around
> > > http://mail.yahoo.com
> > >
> > --
> > Ian Firla Consulting
> > http://ianfirla.com
> >
> >
> 
> __
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 


-- 
   Sincerely,
 Forest Liu(åäè)

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



Re: [PHP] carriage returns using error_log?

2005-03-20 Thread Forest Liu
I prefer purpose it's the design concept in PHP error log.
If I would design a system containing error msg displaying. I would
also just simplly ignore the carriage returns character which the
programer passes to my system, in order to keep graceful in sight.


On Sun, 20 Mar 2005 21:50:09 -0500, Kurt Yoder <[EMAIL PROTECTED]> wrote:
> 
> On Mar 20, 2005, at 4:15 PM, Chris Shiflett wrote:
> 
> > Kurt Yoder wrote:
> >> Is there any way to tell error_log to keep the newline characters? I
> >> am
> >> outputting error messages to the error log so I can look at detailed
> >> status information at the time of the error. However, if I put \n in
> >> the
> >> error message, it is treated literally by error_log and I see "\n" in
> >> the log message.
> >
> > Try using double quotes instead of single quotes.
> >
> > Hope that helps.
> >
> > Chris
> 
> Heh... no, I was already using double quotes. I also tried using actual
> carriage returns in the string, that didn't work either.
> 
> Is error_log simply incapable of obeying carriage returns within the
> error string?
> 
> --
> 
> Kurt Yoder
> http://yoderhome.com
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 


-- 
   Sincerely,
 Forest Liu(åäè)

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



Re: [PHP] seraching / indexing in php

2005-03-22 Thread Forest Liu
or you can have a try on google:)
"xx site:www.yours.com"


On Tue, 22 Mar 2005 15:47:01 +0100, Reinhart Viane <[EMAIL PROTECTED]> wrote:
> I'm looking for a script which indexes the pages of a site (dynamic pages)
> in a dbase and makes it possible to search the site based on
> keywords/sentences/etc.
> 
> Does anyone has any experience with such scripts and which do they
> recommend?
> 
> Thx in advance
> 
> Reinhart
> 
> 


-- 
   Sincerely,
 Forest Liu(åäè)

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



Re: [PHP] Listing directory, return none if only one file

2005-03-24 Thread Forest Liu
it's better for getting help if you could show your code.


On Thu, 24 Mar 2005 12:15:11 +0200, Alexandru Martin
<[EMAIL PROTECTED]> wrote:
> I have a script that lists the files in a directory, but when i have
> only ONE file , it won't display it ( here is the code :
> http://www.pastebin.com/262050 )
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 


-- 
       Sincerely,
 Forest Liu(刘云?)

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