Re: [PHP] return

2002-04-01 Thread Erik Price


On Monday, April 1, 2002, at 02:13  PM, Jordan K. Martin wrote:

 Makes sense.  I didn't think much when writing that piece...but...what 
 is
 the  for?  wouldn't it work the same without it?

 function test ($var)
 {
 $var = addslashes($var)
 }

  $foo = He's dreaming;
  test($foo);
  print($foo);

No, this won't work because you're not returning a value.  You need to 
either have a return statement in this function that says return $var; 
or you need to use the  sign, which lets you change the value of a 
variable outside the namespace of the function.  Or scope.  I forget 
which it is.

Try your above code -- it shouldn't work.


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

2002-03-31 Thread Rasmus Lerdorf

Nope, that code makes no sense.  $_POST is an array containing the POST
variables.  You make a copy of that array an put it in $foo thereby
overwriting the passed in $foo.  Then you return $$foo which actually ends
up returning a variable named $Array.  It does not look like you have a
$Array variable in scope, and it is surely not what the misguided coder
behind this code was trying to achieve.  In short, this is completely
bogus.

-Rasmus

On Sun, 31 Mar 2002, Gary wrote:

 Can someone explain to me the reason for using return.

 function _getValue($foo)
   {
   $foo = $_POST;
   return ${$foo};
   }

 TIA
 Gary


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

2002-03-31 Thread eric.coleman

But to answer your question

The purpose of return, is to return a value..

function test($var)
{
 return addslashes($var);
}

$foo = Yes, I'am Very Awsome;
$foo = test($foo);
echo($foo);
// echo's, Yes I\'am Very Awsome

Understand?

- Original Message -
From: Rasmus Lerdorf [EMAIL PROTECTED]
To: Gary [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Sunday, March 31, 2002 11:43 PM
Subject: Re: [PHP] return


 Nope, that code makes no sense.  $_POST is an array containing the POST
 variables.  You make a copy of that array an put it in $foo thereby
 overwriting the passed in $foo.  Then you return $$foo which actually ends
 up returning a variable named $Array.  It does not look like you have a
 $Array variable in scope, and it is surely not what the misguided coder
 behind this code was trying to achieve.  In short, this is completely
 bogus.

 -Rasmus

 On Sun, 31 Mar 2002, Gary wrote:

  Can someone explain to me the reason for using return.
 
  function _getValue($foo)
  {
  $foo = $_POST;
  return ${$foo};
  }
 
  TIA
  Gary
 
 
  --
  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 General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] return

2002-03-31 Thread Jordan

Eric,

Isnt there really no need for the 'return' though?

$test ($var)
{
addslashes($var)
}

$foo = He's dreaming;
$foo = test($foo);
print($foo);
//should also print He\'s dreaming

Am I incorrect in thinking this?

-Jordan K. Martin
http://www.newimagedesign.com


Eric Coleman [EMAIL PROTECTED] wrote in message
018e01c1d93d$cd404be0$0201a8c0@zaireweb">news:018e01c1d93d$cd404be0$0201a8c0@zaireweb...
 But to answer your question

 The purpose of return, is to return a value..

 function test($var)
 {
  return addslashes($var);
 }

 $foo = Yes, I'am Very Awsome;
 $foo = test($foo);
 echo($foo);
 // echo's, Yes I\'am Very Awsome

 Understand?

 - Original Message -
 From: Rasmus Lerdorf [EMAIL PROTECTED]
 To: Gary [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Sent: Sunday, March 31, 2002 11:43 PM
 Subject: Re: [PHP] return


  Nope, that code makes no sense.  $_POST is an array containing the POST
  variables.  You make a copy of that array an put it in $foo thereby
  overwriting the passed in $foo.  Then you return $$foo which actually
ends
  up returning a variable named $Array.  It does not look like you have a
  $Array variable in scope, and it is surely not what the misguided coder
  behind this code was trying to achieve.  In short, this is completely
  bogus.
 
  -Rasmus
 
  On Sun, 31 Mar 2002, Gary wrote:
 
   Can someone explain to me the reason for using return.
  
   function _getValue($foo)
   {
   $foo = $_POST;
   return ${$foo};
   }
  
   TIA
   Gary
  
  
   --
   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 General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] return

2002-03-31 Thread Rasmus Lerdorf

Well, you could do it without a return, but first, addslashes() returns
the modified string, it does not do in-place replacement.  And second, you
would need to pass the string in by reference, like this:

function test ( $var)
{
$var = addslashes($var)
}

$foo = He's dreaming;
test($foo);
print($foo);

-Rasmus

On Mon, 1 Apr 2002, Jordan wrote:

 Eric,

 Isnt there really no need for the 'return' though?

 $test ($var)
 {
 addslashes($var)
 }

 $foo = He's dreaming;
 $foo = test($foo);
 print($foo);
 //should also print He\'s dreaming

 Am I incorrect in thinking this?

 -Jordan K. Martin
 http://www.newimagedesign.com


 Eric Coleman [EMAIL PROTECTED] wrote in message
 018e01c1d93d$cd404be0$0201a8c0@zaireweb">news:018e01c1d93d$cd404be0$0201a8c0@zaireweb...
  But to answer your question
 
  The purpose of return, is to return a value..
 
  function test($var)
  {
   return addslashes($var);
  }
 
  $foo = Yes, I'am Very Awsome;
  $foo = test($foo);
  echo($foo);
  // echo's, Yes I\'am Very Awsome
 
  Understand?
 
  - Original Message -
  From: Rasmus Lerdorf [EMAIL PROTECTED]
  To: Gary [EMAIL PROTECTED]
  Cc: [EMAIL PROTECTED]
  Sent: Sunday, March 31, 2002 11:43 PM
  Subject: Re: [PHP] return
 
 
   Nope, that code makes no sense.  $_POST is an array containing the POST
   variables.  You make a copy of that array an put it in $foo thereby
   overwriting the passed in $foo.  Then you return $$foo which actually
 ends
   up returning a variable named $Array.  It does not look like you have a
   $Array variable in scope, and it is surely not what the misguided coder
   behind this code was trying to achieve.  In short, this is completely
   bogus.
  
   -Rasmus
  
   On Sun, 31 Mar 2002, Gary wrote:
  
Can someone explain to me the reason for using return.
   
function _getValue($foo)
{
$foo = $_POST;
return ${$foo};
}
   
TIA
Gary
   
   
--
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 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] return

2002-03-31 Thread Miguel Cruz

On Mon, 1 Apr 2002, Jordan wrote:
 Isnt there really no need for the 'return' though?

Try this program and see what happens:

?
   function triple1($x) { $x = $x * 3; return $x; }

   function triple2($x) { $x = $x * 3; }

   function triple3($x) { global $x; $x = $x * 3; }

   $x = 5; $x = triple1($x) print 'ptriple1: ' . $x;
   $x = 5; print 'ptriple1 return: ' . triple1($x);
   $x = 5; $x = triple2($x) print 'ptriple2: ' . $x;
   $x = 5; print 'ptriple2 return: ' . triple2($x);
   $x = 5; $x = triple3($x) print 'ptriple3: ' . $x;
   $x = 5; print 'ptriple3 return: ' . triple3($x);
?

miguel


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




Re: [PHP] return

2002-03-31 Thread Miguel Cruz

On Sun, 31 Mar 2002, Miguel Cruz wrote:
 On Mon, 1 Apr 2002, Jordan wrote:
 Isnt there really no need for the 'return' though?
 
 Try this program and see what happens:

Ah, Rasmus brings up a good point. Try this one instead.

?
   function triple1($x) { $x = $x * 3; return $x; }

   function triple2($x) { $x = $x * 3; }

   function triple3($x) { global $x; $x = $x * 3; }

   function triple4($x) { $x = $x * 3; }

   $x = 5; $x = triple1($x) print 'ptriple1: ' . $x;
   $x = 5; print 'ptriple1 return: ' . triple1($x);
   $x = 5; $x = triple2($x) print 'ptriple2: ' . $x;
   $x = 5; print 'ptriple2 return: ' . triple2($x);
   $x = 5; $x = triple3($x) print 'ptriple3: ' . $x;
   $x = 5; print 'ptriple3 return: ' . triple3($x);
   $x = 5; $x = triple4($x) print 'ptriple4: ' . $x;
   $x = 5; print 'ptriple4 return: ' . triple4($x);
?

miguel


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




Re: [PHP] return

2002-03-31 Thread jtjohnston

Gary,
To add to the conversation ...

You created a function to pass something through it, to process something and
now you want to get something back, right? That's what return does. It gets
something back for your effort.

You could simply:

echo addslashes($var);

But let's say you do it a hundred times in the course of a script. You don't
want to take up a hundred lines of code doing:

echo addslashes($var);

... so you create a function like Eric has below, which takes up 3 or 4 lines of
code, but has the capacity to repeat the same line of code 100 times.

John

 The purpose of return, is to return a value..
 function test($var)
 {
  return addslashes($var);
 }

 $foo = Yes, I'am Very Awsome;
 $foo = test($foo);
 echo($foo);
 // echo's, Yes I\'am Very Awsome


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




Re: [PHP] Return the column names of MySQL table?

2002-03-19 Thread Geoff Hankerson

I believe it is:
describe tablename;
- Original Message - 
From: Kevin Stone [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, March 19, 2002 4:43 PM
Subject: [PHP] Return the column names of MySQL table?


 Forgive me for the off topic question.  This is a MySQL question.. has
 nothing to do with PHP directly.  However I was not able to find an
 answer in the MySQL documentation, on Usenet, or the MySQL mailing list
 archives.  Also MySQL.com's  mail manager is on the fritz so I can't
 even subscribe to the MySQL email list.  Anyway since many of you are
 familiar with SQL this is as good a place to ask this question as any.
  
 I simply need to return a list of column names of a MySQL table.  What's
 the syntax to do that?
  
 Thanks,
 Kevin
 


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




Re: [PHP] Return the column names of MySQL table?

2002-03-19 Thread Erik Price


On Tuesday, March 19, 2002, at 05:43  PM, Kevin Stone wrote:

 I simply need to return a list of column names of a MySQL table.  What's
 the syntax to do that?

SHOW COLUMNS FROM tablename;






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] Return the column names of MySQL table?

2002-03-19 Thread J.F.Kishor

Hi,
Try the following,

?
  mysql_connect(DBServer,DBUser,DBPassword);
  $queryColumn = mysql(DBName,desc tableName);
  $columnCount = //Find out the number of column in the table.  
  $index=0;
  while($index  $columnCount) 
   {
  $columnName = mysql_result($queryColumn,$index,Field);
  echo pColumn name ($index) : $columnName/p; 
  $index++; 
   }
?

 


On Tue, 19 Mar 2002, Kevin Stone wrote:

 Forgive me for the off topic question.  This is a MySQL question.. has
 nothing to do with PHP directly.  However I was not able to find an
 answer in the MySQL documentation, on Usenet, or the MySQL mailing list
 archives.  Also MySQL.com's  mail manager is on the fritz so I can't
 even subscribe to the MySQL email list.  Anyway since many of you are
 familiar with SQL this is as good a place to ask this question as any.
  
 I simply need to return a list of column names of a MySQL table.  What's
 the syntax to do that?
  
 Thanks,
 Kevin
 

-- 
- JFK
kishor
Nilgiri Networks






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




Re: [PHP] Return values from shell_exec command into db

2002-03-06 Thread Jason Wong

On Wednesday 06 March 2002 18:23, Sven Jacobs wrote:
 Hey

 I want to run a shell script, all the values that are returned normal by
 that script I want to put as var.
 For example

 tracert X.X.X.X

   1   10 ms   10 ms   10 ms  blablabla.bla.com [X.X.X.X]
   2   10 ms10 ms10 ms  RFC1918-Host [X.X.X.X]
   3   10 ms10 ms10 ms  BUOPS [X.X.X.X]

 The 3 values I want tot put in a table when I run the script


  $output = `tracert x.x.x.x`;

$output now contains the results of whatever command you executed. It's all 
nicely explained in the manual, Program Execution functions.

-- 
Jason Wong - Gremlins Associates - www.gremlins.com.hk

/*
strategy, n.:
A comprehensive plan of inaction.
*/

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




RE: [PHP] Return Adress

2001-08-09 Thread billfarr

Hey, there...

I ran into this yesterday along with learning a heap more PHP.  Adding a
Reply-To: [EMAIL PROTECTED] header seemed to work fine.

Hope this helps,
Bill

-Original Message-
From: Jean-Arthur Silve [mailto:[EMAIL PROTECTED]]
Sent: Thursday, August 09, 2001 5:23 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Return Adress




Hi !

I ve got a problem with the mail function :

My http server (Apache) is running as user web and php is compiled as a 
module.

When I send a mail with the mail function and, for example, the recipient 
does not exists, the return message is sent to [EMAIL PROTECTED]

I would like the error messages are sent to another email adress.

I tried with the mail header Return-path: [EMAIL PROTECTED] but 
the error messages keep going to [EMAIL PROTECTED]

My code is :

$head=From: .$EMAILADMIN.\nReturn-Path: [EMAIL PROTECTED]\n;
mail($to,$sub,$msg,$head);

Is there a way to force the error messages to go to another email adress ?
Another header ?
If it's sendmail that change the return address, is there a way to prevent 
this ?

Thanks !

jean-arthur





---
EuroVox
4, place Félix Eboue
75583 Paris Cedex 12
Tel : 01 44 67 05 05
Fax : 01 44 67 05 19
Web : http://www.eurovox.fr



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



Re: [PHP] Return Adress

2001-08-09 Thread Richard Lynch

You also should use \r\n instead of just \n to be really spec.

Double-check RFC spelling of Reply-To: or Reply-to:  Capitalization matters
for email headers.

--
WARNING [EMAIL PROTECTED] address is an endangered species -- Use
[EMAIL PROTECTED]
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm
- Original Message -
From: [EMAIL PROTECTED]
Newsgroups: php.general
To: [EMAIL PROTECTED]
Sent: Thursday, August 09, 2001 11:27 AM
Subject: RE: [PHP] Return Adress


Hey, there...

I ran into this yesterday along with learning a heap more PHP.  Adding a
Reply-To: [EMAIL PROTECTED] header seemed to work fine.

Hope this helps,
Bill

-Original Message-
From: Jean-Arthur Silve [mailto:[EMAIL PROTECTED]]
Sent: Thursday, August 09, 2001 5:23 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Return Adress




Hi !

I ve got a problem with the mail function :

My http server (Apache) is running as user web and php is compiled as a
module.

When I send a mail with the mail function and, for example, the recipient
does not exists, the return message is sent to [EMAIL PROTECTED]

I would like the error messages are sent to another email adress.

I tried with the mail header Return-path: [EMAIL PROTECTED] but
the error messages keep going to [EMAIL PROTECTED]

My code is :

$head=From: .$EMAILADMIN.\nReturn-Path: [EMAIL PROTECTED]\n;
mail($to,$sub,$msg,$head);

Is there a way to force the error messages to go to another email adress ?
Another header ?
If it's sendmail that change the return address, is there a way to prevent
this ?

Thanks !

jean-arthur





---
EuroVox
4, place Félix Eboue
75583 Paris Cedex 12
Tel : 01 44 67 05 05
Fax : 01 44 67 05 19
Web : http://www.eurovox.fr



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] return value from recursive function

2001-07-29 Thread Dave

maybe it is just me and my preferred syntax/style...

if ($i  4) {
abc_recurse();
}
return 'xyz';  # NOTICE REMOVED ()'s

Did not look to closely at your shortcut symantics to verify legitimacy
Also, unless I am mistaken, people generally advise against having a function do
output.  A more appropriate syntax might be

?
function abc_recurse($r) {
global $r;
static $i = 1;
$r.=$i;
$i++;
if ($i  4) {
abc_recurse($r);
}
return $r.'xyz';
}
$returnvalue = abc_recurse(0);
echo $returnvalue;
?

messy but a quick example.

-Original Message-
From: Jaskirat [mailto:[EMAIL PROTECTED]]
Sent: Sunday, July 29, 2001 8:47 PM
To: [EMAIL PROTECTED]
Subject: [PHP] return value from recursive function


Hi,
How to get return value from a recursive function .. here is the test code
which I was trying

?
function abc_recurse()
{
   static $i = 1;
   echo $i;
   $i++;
   if ($i == 4) return (xyz);
   abc_recurse();

}

$returnvalue = abc_recurse();
echo $returnvalue;

?
Its printing 123 where as I was expecting 123xyz
what is happening to $returnvalue

TIA
Jaski


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] return

2001-07-16 Thread Boget, Chris

 Here's my code:
 ?
 function expDate($date) {
 $month = substr($date, 0, 2);
 $len = strlen($date);
 $year = substr($date, $len-2, $len);
 return $month;
 return $year;
 }
 expDate(11/2002);
 print $month $year;
 ?
 I know this isn't the correct usage of return, but how to I 
 get the $month and $year variables so I can print them 
 after I've called the expDate() function?  Currently, nothing 
 is printed to the browser.

You cannot use return twice like that.  The function will
exit immediately after the first valid return call it hits.
To do what you want, you can do this:



function expDate($date, $returnMonth, $returnYear ) {
$month = substr($date, 0, 2);
$len = strlen($date);
$year = substr($date, $len-2, $len);
$returnMonth = $month;
$returnYear = $year;
}

$month = 0;
$year = 0;

expDate( 11/2002, $month, $year );
print $month $year;

--

The  operator passes a variable by reference.

Alternately, you can do:



function expDate($date, $returnMonth, $returnYear ) {
global $month;
global $year;

$month = substr($date, 0, 2);
$len = strlen($date);
$year = substr($date, $len-2, $len);

}

$month = 0;
$year = 0;

expDate( 11/2002 );
print $month $year;

--

Though, I try to use global as little as possible.

Chris



RE: [PHP] return

2001-07-16 Thread Don Read


On 16-Jul-01 Tyler Longren wrote:
 Here's my code:
 ?
 function expDate($date) {
 $month = substr($date, 0, 2);
 $len = strlen($date);
 $year = substr($date, $len-2, $len);
 return $month;
 return $year;
 }
 expDate(11/2002);
 print $month $year;
 ?
 
 I know this isn't the correct usage of return, but how to I get the $month
 and $year variables so I can print them after I've called the expDate()
 function?  Currently, nothing is printed to the browser.
 

return array($month, $year);

 -- or --

function expDate($date,$month,$year) {
  ...
}

expDate(11/2002,$month,$year);
print ...

 -- or --

list($month, $year)=explode(/, 11/2002);


Regards,
-- 
Don Read   [EMAIL PROTECTED]
-- It's always darkest before the dawn. So if you are going to 
   steal the neighbor's newspaper, that's the time to do it.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] return

2001-07-16 Thread Alexander Skwar

So sprach »Tyler Longren« am 2001-07-16 um 15:25:08 -0500 :
 function?  Currently, nothing is printed to the browser.

No wonder, because you don't assign the returned value of expDate to
anything..

well, if you want to return two values, I'd suggest to use an array,
like so:

function expDate($date){
  $month = 08; // whatever
  $year = 15; // whatever

  $return_value = array(
month = $month,
year  = $year
  );

  return $return_value;
}

$date = expDate(4711);
print $date[month] .   . $date[year];

Alexander Skwar
-- 
How to quote:   http://learn.to/quote (german) http://quote.6x.to (english)
Homepage:   http://www.digitalprojects.com   |   http://www.iso-top.de
   iso-top.de - Die günstige Art an Linux Distributionen zu kommen
Uptime: 5 hours 23 minutes

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] return

2001-07-16 Thread Alexander Skwar

So sprach »Alexander 'Digital Projects' Skwar« am 2001-07-16 um 22:38:44 +0200 :
 anything..

correction: Whoops - there's a . missing

anything...

Alexander Skwar
-- 
How to quote:   http://learn.to/quote (german) http://quote.6x.to (english)
Homepage:   http://www.digitalprojects.com   |   http://www.iso-top.de
   iso-top.de - Die günstige Art an Linux Distributionen zu kommen
Uptime: 5 hours 31 minutes

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] return parse error

2001-04-13 Thread Jeffrey Paul

At 03:56 AM 4/13/2001, Peter Harkins wrote:
 This generates a parse error:
 mysql_connect("localhost", "root", "rootpw") or 
 return("bar");

 But all the following work fine:
 mysql_connect("localhost", "root", "rootpw") or die("bar");

 mysql_connect("localhost", "root", "rootpw") or 
 print("bar");

 if (!mysql_connect("localhost", "root", "rootpw")) {
 return("bar");
 }

 Why? mysql_connect returns false on failure either way... I 
 notice die


return isn't a function but a language construct.   This is why the third 
working line with the curlybraces works, and without them it doesn't.

include() is a language construct too.  the particulars of using language 
constructs (like return() and include()) with control structure syntax are 
explained on the page for include().

http://us2.php.net/manual/en/function.include.php

-j (aka sneak)



--
[EMAIL PROTECTED]  -   0x514DB5CB
he who lives these words shall not taste death
becoming nothing yeah yeah
forever liquid cool


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] return parse error

2001-04-13 Thread Yasuo Ohgaki

Small additional info about  "expression" and "language construct".

Expression is anything that have value.

Therefore, if language construct returns value = valid expression.

Following code works:

($val) ? include('abc.php') : include('def.php');

Following code does NOT work:

($val) ? echo('abc') : echo('def');

both "include" and "echo" is language construct, but "include" returns value.
Thus "include" is valid expression while "echo" is not.
"return" does not return value. (It returns value to caller, but not return
value for expression context)

User defined functions always return value, even if there is no "return"
statement = functions are always valid expression.

Hope this helps.
--
Yasuo Ohgaki


"Jeffrey Paul" [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 At 03:56 AM 4/13/2001, Peter Harkins wrote:
  This generates a parse error:
  mysql_connect("localhost", "root", "rootpw") or
  return("bar");
 
  But all the following work fine:
  mysql_connect("localhost", "root", "rootpw") or die("bar");
 
  mysql_connect("localhost", "root", "rootpw") or
  print("bar");
 
  if (!mysql_connect("localhost", "root", "rootpw")) {
  return("bar");
  }
 
  Why? mysql_connect returns false on failure either way... I
  notice die


 return isn't a function but a language construct.   This is why the third
 working line with the curlybraces works, and without them it doesn't.

 include() is a language construct too.  the particulars of using language
 constructs (like return() and include()) with control structure syntax are
 explained on the page for include().

 http://us2.php.net/manual/en/function.include.php

 -j (aka sneak)



 --
 [EMAIL PROTECTED]  -   0x514DB5CB
 he who lives these words shall not taste death
 becoming nothing yeah yeah
 forever liquid cool


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Return Image for PHP Link

2001-02-27 Thread Ron Wills


I'm not 100% sure this works, but maybe try something like this:
img src="? include 'myphpcode.php'; ?>">
If that doesn't work, you can always have the php generate the entire
tag
?
 $image = "myimagefile.gif"; // What ever you need
 print "img src=\"$image\">";
?>
Hope this helps :-)
"Karl J. Stubsjoen" wrote:
Hello,
I'd like the source of an image tag to point to PHP code. I'd
like that PHP
code to generate an image (accordingly) and print/output the results
back to
the calling image. So:
img src="myphpcode.php">
Where, myphpcode.php returns a valid image.
I've done this before, but it is not fresh in my brain.
Any help would be appreciated!
Karl
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

--
209 Media http://www.209media.com>
Ron Wills [EMAIL PROTECTED]>
Programmer


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


Re: [PHP] Return ODBC Results to an array

2001-02-13 Thread Ifrim Sorin

You can use mysql_fetch_array() for each row returned in the cursor.

Sorin Ifrim


- Original Message - 
From: Karl J. Stubsjoen [EMAIL PROTECTED]
To: PHP Mailing List [EMAIL PROTECTED]
Sent: Tuesday, February 13, 2001 7:32 PM
Subject: [PHP] Return ODBC Results to an array


 Is there a way to return the results of a query straight into an array?
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Return ODBC Results to an array

2001-02-13 Thread Ifrim Sorin

For ODBC, the function is odbc_fetch_into().

Sorin Ifrim

- Original Message - 
From: Karl J. Stubsjoen [EMAIL PROTECTED]
To: PHP Mailing List [EMAIL PROTECTED]
Sent: Tuesday, February 13, 2001 7:32 PM
Subject: [PHP] Return ODBC Results to an array


 Is there a way to return the results of a query straight into an array?
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Return ODBC Results to an array

2001-02-13 Thread Andrew Hill

Karl,


http://www.php.net/manual/en/function.odbc-fetch-into.php

Best regards,
Andrew
--
Andrew Hill - OpenLink Software
Director Technology Evangelism
eBusiness Infrastructure Technology 
http://www.openlinksw.com

 -Original Message-
 From: Karl J. Stubsjoen [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, February 13, 2001 12:33 PM
 To: PHP Mailing List
 Subject: [PHP] Return ODBC Results to an array
 
 
 Is there a way to return the results of a query straight into an array?
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]
 
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




<    1   2