|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
php-general-digest-help_at_lists.php.net
Date: Sat Jul 27 2002 - 08:38:56 CDT
php-general Digest 27 Jul 2002 13:38:56 -0000 Issue 1489
Topics (messages 109909 through 109957):
Re: calling user-defined php functions from <a href> tag
109909 by: Justin French
109911 by: Michael
109912 by: Mathieu Dumoulin
109913 by: Michael
109915 by: Mathieu Dumoulin
109917 by: Bob Lockie
109929 by: Nick Oostveen
109930 by: Chris Earle
109950 by: Justin French
Call func with variable num params (Dont confuse with making func variable params)
109910 by: Mathieu Dumoulin
109931 by: Tom Rogers
RE:
109914 by: John Holmes
Re: Possible to have optional values in function?
109916 by: JJ Harrison
need help with unusual php/mysql/array manipulation script
109918 by: spam
109928 by: Chris Earle
Re: Cookies
109919 by: John Huggins
problems with func_get_arg()
109920 by: James Nord
109927 by: Chris Earle
Re: Red Hat 7.2 enabling MySQL on preinstalled PHP
109921 by: Jason Wong
Quotes getting screwed up in form fields
109922 by: Monty
109925 by: Chris Earle
109945 by: lallous
Re: adding Databases
109923 by: Lord Loh.
Re: filling an array(2)
109924 by: Chris Earle
Re: Table formatting
109926 by: Chris Earle
snapshot windows build
109932 by: Josh Levine
I hate to do this - Parse error...
109933 by: JJ Harrison
109936 by: Chris Earle
109943 by: JJ Harrison
Is it possible...
109934 by: apollo
109939 by: lallous
109942 by: Lars Olsson
Re: phpMyAdmin and apqache 2.0.39 cache problems
109935 by: electroteque
Re: PHP / Apache 2.0.39 issues
109937 by: electroteque
Re: How to UPDATE two MySQL Tables
109938 by: Chris Earle
Re: How can I get my session variable to pass to another page?
109940 by: lallous
Re: Calling a function without variable params
109941 by: lallous
Re: Logging: Best archive method
109944 by: lallous
Re: Using Javascript
109946 by: Zoltan Konyves
Date() Problem
109947 by: Tony Harrison
109948 by: Jome
109949 by: Tony Harrison
109951 by: Jome
109954 by: JJ Harrison
109955 by: Tony Harrison
109956 by: Justin French
Re: High Resolution Images
109952 by: Peter
Re: How to defeat winroute [proxy]?
109953 by: Peter
removing html...
109957 by: JJ Harrison
Administrivia:
To subscribe to the digest, e-mail:
php-general-digest-subscribe
lists.php.net
To unsubscribe from the digest, e-mail:
php-general-digest-unsubscribe
lists.php.net
To post to the list, e-mail:
php-general
lists.php.net
----------------------------------------------------------------------
attached mail follows:
on 27/07/02 12:09 PM, Michael (mlee
ni-solutions.com) wrote:
> <?php
> function joe() {
> $temp1=10;
> $temp2=20;
> $result=$temp1+$temp2;
> echo "The result of this function is: " . $result;
> }
> ?>
wouldn't that be
return "The result of this function is: " . $result;
rather than echo?
Anyhoo, you haven't specified HOW you want to communicate the result of the
function to the browser.
A HREF is supposed to take you off to another page (amongst other things),
which might be what you're after.
JavaScript (*shudder*) is designed to provide client-side actions, so maybe
a javascript alert is what you want, or a pop-up window, or who knows what.
You need to decide what happens, in a story board fashion.
Remember, everything in PHP code takes place on the server, BEFORE the
browser gets it.
Example of using JS alert:
<HTML>
<?
function joe() {
$temp1=10;
$temp2=20;
$result=$temp1+$temp2;
return "The result of this function is: " . $result;
}
?>
<A HREF="#" onclick="javascript:alert('<?=joe()?>')">calculate foo</a>
</HTML>
but really, I can't understand why you wouldn't just do:
<HTML>
<?
$result=$temp1+$temp2;
echo "Total: {$result}";
?>
</HTML>
Why do they have to click?
You'll have to check all the javascript stuff and maybe massage it, because
I haven't tested this, and haven't written much JS in the past coupla years.
Beware of the limitations of relying on javascript for anything though :)
Justin French
attached mail follows:
Hi, Justin.
Thanks very much for the reponse.
Yeah, this is a SUPER simplified form of my question, so please don't
expect it to make sense. Heh.
Basically, I have a php file with dozens of functions in it. I want ONE of
them to get called when a link is clicked.
Currently, I achieve this with the use of HTML forms. My form generates a
list of options. And the user has to select an option, then click the
SUBMIT button.
But I want to make it a one-step process, whereby the user only needs to
click on the option.
Of course, you can't achieve this in a form with JavaScript, but the
JavaScript code won't let me execute a server-side php function
(obviously).
And I don't want to just shoot the link off to another page (even though
that's what it was designed to do). I want to call a very specific
function.
Tricky, I know. :(
-- Michael
On Sat, 27 Jul 2002, Justin French wrote:
> Date: Sat, 27 Jul 2002 11:35:23 +1000
> From: Justin French <justin
indent.com.au>
> To: Michael <mlee
ni-solutions.com>, php-general
lists.php.net
> Subject: Re: [PHP] calling user-defined php functions from <a href> tag
>
> on 27/07/02 12:09 PM, Michael (mlee
ni-solutions.com) wrote:
>
> > <?php
> > function joe() {
> > $temp1=10;
> > $temp2=20;
> > $result=$temp1+$temp2;
> > echo "The result of this function is: " . $result;
> > }
> > ?>
>
> wouldn't that be
>
> return "The result of this function is: " . $result;
>
> rather than echo?
>
>
> Anyhoo, you haven't specified HOW you want to communicate the result of the
> function to the browser.
>
> A HREF is supposed to take you off to another page (amongst other things),
> which might be what you're after.
>
> JavaScript (*shudder*) is designed to provide client-side actions, so maybe
> a javascript alert is what you want, or a pop-up window, or who knows what.
>
> You need to decide what happens, in a story board fashion.
>
>
> Remember, everything in PHP code takes place on the server, BEFORE the
> browser gets it.
>
>
> Example of using JS alert:
>
> <HTML>
> <?
> function joe() {
> $temp1=10;
> $temp2=20;
> $result=$temp1+$temp2;
> return "The result of this function is: " . $result;
> }
> ?>
> <A HREF="#" onclick="javascript:alert('<?=joe()?>')">calculate foo</a>
> </HTML>
>
> but really, I can't understand why you wouldn't just do:
>
> <HTML>
> <?
> $result=$temp1+$temp2;
> echo "Total: {$result}";
> ?>
> </HTML>
>
> Why do they have to click?
>
>
> You'll have to check all the javascript stuff and maybe massage it, because
> I haven't tested this, and haven't written much JS in the past coupla years.
>
>
> Beware of the limitations of relying on javascript for anything though :)
>
>
> Justin French
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
attached mail follows:
Easy
Your form when pressed the button submit will send the data from the form
via post (Which is the best method) to the functions.php with all the
functions. What you need to modify now is that all the <input type=radio>
need to be modified to "FuncToExec" name.
When you receive the input of the form, you just verify what $FuncToExec is
and execute the correct function.
<?php
if($FuncToExec == "joe"){
joe();
}elseif(...){
}
... (All functions in your file goes there)...
?>
Now what you also want to add is that if your JOE function is to return
something, the IF ELSE calling that thing should intercept the value
returned and this part of the script should either do something with that
value or just redirect the value to another script by GET mode:
header("location: myresultpage.php?result=$result");
There, sorted that out right?
have fun
insanecoder!
"Michael" <mlee
ni-solutions.com> wrote in message
news:Pine.LNX.4.44.0207262140050.25862-100000
shiner.ni-solutions.com...
>
>
> Hi, Justin.
>
> Thanks very much for the reponse.
> Yeah, this is a SUPER simplified form of my question, so please don't
> expect it to make sense. Heh.
>
> Basically, I have a php file with dozens of functions in it. I want ONE of
> them to get called when a link is clicked.
>
> Currently, I achieve this with the use of HTML forms. My form generates a
> list of options. And the user has to select an option, then click the
> SUBMIT button.
>
> But I want to make it a one-step process, whereby the user only needs to
> click on the option.
>
> Of course, you can't achieve this in a form with JavaScript, but the
> JavaScript code won't let me execute a server-side php function
> (obviously).
>
> And I don't want to just shoot the link off to another page (even though
> that's what it was designed to do). I want to call a very specific
> function.
>
> Tricky, I know. :(
>
> -- Michael
>
> On Sat, 27 Jul 2002, Justin French wrote:
>
> > Date: Sat, 27 Jul 2002 11:35:23 +1000
> > From: Justin French <justin
indent.com.au>
> > To: Michael <mlee
ni-solutions.com>, php-general
lists.php.net
> > Subject: Re: [PHP] calling user-defined php functions from <a href> tag
> >
> > on 27/07/02 12:09 PM, Michael (mlee
ni-solutions.com) wrote:
> >
> > > <?php
> > > function joe() {
> > > $temp1=10;
> > > $temp2=20;
> > > $result=$temp1+$temp2;
> > > echo "The result of this function is: " . $result;
> > > }
> > > ?>
> >
> > wouldn't that be
> >
> > return "The result of this function is: " . $result;
> >
> > rather than echo?
> >
> >
> > Anyhoo, you haven't specified HOW you want to communicate the result of
the
> > function to the browser.
> >
> > A HREF is supposed to take you off to another page (amongst other
things),
> > which might be what you're after.
> >
> > JavaScript (*shudder*) is designed to provide client-side actions, so
maybe
> > a javascript alert is what you want, or a pop-up window, or who knows
what.
> >
> > You need to decide what happens, in a story board fashion.
> >
> >
> > Remember, everything in PHP code takes place on the server, BEFORE the
> > browser gets it.
> >
> >
> > Example of using JS alert:
> >
> > <HTML>
> > <?
> > function joe() {
> > $temp1=10;
> > $temp2=20;
> > $result=$temp1+$temp2;
> > return "The result of this function is: " . $result;
> > }
> > ?>
> > <A HREF="#" onclick="javascript:alert('<?=joe()?>')">calculate foo</a>
> > </HTML>
> >
> > but really, I can't understand why you wouldn't just do:
> >
> > <HTML>
> > <?
> > $result=$temp1+$temp2;
> > echo "Total: {$result}";
> > ?>
> > </HTML>
> >
> > Why do they have to click?
> >
> >
> > You'll have to check all the javascript stuff and maybe massage it,
because
> > I haven't tested this, and haven't written much JS in the past coupla
years.
> >
> >
> > Beware of the limitations of relying on javascript for anything though
:)
> >
> >
> > Justin French
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
attached mail follows:
Hmm.
Hey, Mathieu. Many thanks for the reply. However, I currently AM using a
form. What I'm trying to get away from, is the two step process:
1. pick your option
2. click submit
I'm trying to get a one-step process, where the user can click on a link,
and that calls the function.
JavaScript won't work, because it's client side, and can't be used to call
a server-side php function (unless you tell me some neat trick I don't
know about yet). See my struggle now?
On Fri, 26 Jul 2002, Mathieu Dumoulin wrote:
> Date: Fri, 26 Jul 2002 21:46:00 -0400
> From: Mathieu Dumoulin <mdumoulin
groupimage.com>
> To: php-general
lists.php.net
> Subject: Re: [PHP] calling user-defined php functions from <a href> tag
>
> Easy
>
> Your form when pressed the button submit will send the data from the form
> via post (Which is the best method) to the functions.php with all the
> functions. What you need to modify now is that all the <input type=radio>
> need to be modified to "FuncToExec" name.
>
> When you receive the input of the form, you just verify what $FuncToExec is
> and execute the correct function.
>
> <?php
>
> if($FuncToExec == "joe"){
> joe();
> }elseif(...){
> }
>
> ... (All functions in your file goes there)...
>
> ?>
>
> Now what you also want to add is that if your JOE function is to return
> something, the IF ELSE calling that thing should intercept the value
> returned and this part of the script should either do something with that
> value or just redirect the value to another script by GET mode:
>
> header("location: myresultpage.php?result=$result");
>
> There, sorted that out right?
>
> have fun
> insanecoder!
>
> "Michael" <mlee
ni-solutions.com> wrote in message
> news:Pine.LNX.4.44.0207262140050.25862-100000
shiner.ni-solutions.com...
> >
> >
> > Hi, Justin.
> >
> > Thanks very much for the reponse.
> > Yeah, this is a SUPER simplified form of my question, so please don't
> > expect it to make sense. Heh.
> >
> > Basically, I have a php file with dozens of functions in it. I want ONE of
> > them to get called when a link is clicked.
> >
> > Currently, I achieve this with the use of HTML forms. My form generates a
> > list of options. And the user has to select an option, then click the
> > SUBMIT button.
> >
> > But I want to make it a one-step process, whereby the user only needs to
> > click on the option.
> >
> > Of course, you can't achieve this in a form with JavaScript, but the
> > JavaScript code won't let me execute a server-side php function
> > (obviously).
> >
> > And I don't want to just shoot the link off to another page (even though
> > that's what it was designed to do). I want to call a very specific
> > function.
> >
> > Tricky, I know. :(
> >
> > -- Michael
> >
> > On Sat, 27 Jul 2002, Justin French wrote:
> >
> > > Date: Sat, 27 Jul 2002 11:35:23 +1000
> > > From: Justin French <justin
indent.com.au>
> > > To: Michael <mlee
ni-solutions.com>, php-general
lists.php.net
> > > Subject: Re: [PHP] calling user-defined php functions from <a href> tag
> > >
> > > on 27/07/02 12:09 PM, Michael (mlee
ni-solutions.com) wrote:
> > >
> > > > <?php
> > > > function joe() {
> > > > $temp1=10;
> > > > $temp2=20;
> > > > $result=$temp1+$temp2;
> > > > echo "The result of this function is: " . $result;
> > > > }
> > > > ?>
> > >
> > > wouldn't that be
> > >
> > > return "The result of this function is: " . $result;
> > >
> > > rather than echo?
> > >
> > >
> > > Anyhoo, you haven't specified HOW you want to communicate the result of
> the
> > > function to the browser.
> > >
> > > A HREF is supposed to take you off to another page (amongst other
> things),
> > > which might be what you're after.
> > >
> > > JavaScript (*shudder*) is designed to provide client-side actions, so
> maybe
> > > a javascript alert is what you want, or a pop-up window, or who knows
> what.
> > >
> > > You need to decide what happens, in a story board fashion.
> > >
> > >
> > > Remember, everything in PHP code takes place on the server, BEFORE the
> > > browser gets it.
> > >
> > >
> > > Example of using JS alert:
> > >
> > > <HTML>
> > > <?
> > > function joe() {
> > > $temp1=10;
> > > $temp2=20;
> > > $result=$temp1+$temp2;
> > > return "The result of this function is: " . $result;
> > > }
> > > ?>
> > > <A HREF="#" onclick="javascript:alert('<?=joe()?>')">calculate foo</a>
> > > </HTML>
> > >
> > > but really, I can't understand why you wouldn't just do:
> > >
> > > <HTML>
> > > <?
> > > $result=$temp1+$temp2;
> > > echo "Total: {$result}";
> > > ?>
> > > </HTML>
> > >
> > > Why do they have to click?
> > >
> > >
> > > You'll have to check all the javascript stuff and maybe massage it,
> because
> > > I haven't tested this, and haven't written much JS in the past coupla
> years.
> > >
> > >
> > > Beware of the limitations of relying on javascript for anything though
> :)
> > >
> > >
> > > Justin French
> > >
> > >
> > > --
> > > 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
>
>
attached mail follows:
Then simple,
In your hrefs do:
<a href="myfunctions.php?FuncToExec=Joe">Execute Joe() function</a>
thats all there is to it
InsaneCoder
"Michael" <mlee
ni-solutions.com> wrote in message
news:Pine.LNX.4.44.0207262151010.25873-100000
shiner.ni-solutions.com...
>
>
> Hmm.
>
> Hey, Mathieu. Many thanks for the reply. However, I currently AM using a
> form. What I'm trying to get away from, is the two step process:
>
> 1. pick your option
> 2. click submit
>
> I'm trying to get a one-step process, where the user can click on a link,
> and that calls the function.
>
> JavaScript won't work, because it's client side, and can't be used to call
> a server-side php function (unless you tell me some neat trick I don't
> know about yet). See my struggle now?
>
>
>
>
> On Fri, 26 Jul 2002, Mathieu Dumoulin wrote:
>
> > Date: Fri, 26 Jul 2002 21:46:00 -0400
> > From: Mathieu Dumoulin <mdumoulin
groupimage.com>
> > To: php-general
lists.php.net
> > Subject: Re: [PHP] calling user-defined php functions from <a href> tag
> >
> > Easy
> >
> > Your form when pressed the button submit will send the data from the
form
> > via post (Which is the best method) to the functions.php with all the
> > functions. What you need to modify now is that all the <input
type=radio>
> > need to be modified to "FuncToExec" name.
> >
> > When you receive the input of the form, you just verify what $FuncToExec
is
> > and execute the correct function.
> >
> > <?php
> >
> > if($FuncToExec == "joe"){
> > joe();
> > }elseif(...){
> > }
> >
> > ... (All functions in your file goes there)...
> >
> > ?>
> >
> > Now what you also want to add is that if your JOE function is to return
> > something, the IF ELSE calling that thing should intercept the value
> > returned and this part of the script should either do something with
that
> > value or just redirect the value to another script by GET mode:
> >
> > header("location: myresultpage.php?result=$result");
> >
> > There, sorted that out right?
> >
> > have fun
> > insanecoder!
> >
> > "Michael" <mlee
ni-solutions.com> wrote in message
> > news:Pine.LNX.4.44.0207262140050.25862-100000
shiner.ni-solutions.com...
> > >
> > >
> > > Hi, Justin.
> > >
> > > Thanks very much for the reponse.
> > > Yeah, this is a SUPER simplified form of my question, so please don't
> > > expect it to make sense. Heh.
> > >
> > > Basically, I have a php file with dozens of functions in it. I want
ONE of
> > > them to get called when a link is clicked.
> > >
> > > Currently, I achieve this with the use of HTML forms. My form
generates a
> > > list of options. And the user has to select an option, then click the
> > > SUBMIT button.
> > >
> > > But I want to make it a one-step process, whereby the user only needs
to
> > > click on the option.
> > >
> > > Of course, you can't achieve this in a form with JavaScript, but the
> > > JavaScript code won't let me execute a server-side php function
> > > (obviously).
> > >
> > > And I don't want to just shoot the link off to another page (even
though
> > > that's what it was designed to do). I want to call a very specific
> > > function.
> > >
> > > Tricky, I know. :(
> > >
> > > -- Michael
> > >
> > > On Sat, 27 Jul 2002, Justin French wrote:
> > >
> > > > Date: Sat, 27 Jul 2002 11:35:23 +1000
> > > > From: Justin French <justin
indent.com.au>
> > > > To: Michael <mlee
ni-solutions.com>, php-general
lists.php.net
> > > > Subject: Re: [PHP] calling user-defined php functions from <a href>
tag
> > > >
> > > > on 27/07/02 12:09 PM, Michael (mlee
ni-solutions.com) wrote:
> > > >
> > > > > <?php
> > > > > function joe() {
> > > > > $temp1=10;
> > > > > $temp2=20;
> > > > > $result=$temp1+$temp2;
> > > > > echo "The result of this function is: " . $result;
> > > > > }
> > > > > ?>
> > > >
> > > > wouldn't that be
> > > >
> > > > return "The result of this function is: " . $result;
> > > >
> > > > rather than echo?
> > > >
> > > >
> > > > Anyhoo, you haven't specified HOW you want to communicate the result
of
> > the
> > > > function to the browser.
> > > >
> > > > A HREF is supposed to take you off to another page (amongst other
> > things),
> > > > which might be what you're after.
> > > >
> > > > JavaScript (*shudder*) is designed to provide client-side actions,
so
> > maybe
> > > > a javascript alert is what you want, or a pop-up window, or who
knows
> > what.
> > > >
> > > > You need to decide what happens, in a story board fashion.
> > > >
> > > >
> > > > Remember, everything in PHP code takes place on the server, BEFORE
the
> > > > browser gets it.
> > > >
> > > >
> > > > Example of using JS alert:
> > > >
> > > > <HTML>
> > > > <?
> > > > function joe() {
> > > > $temp1=10;
> > > > $temp2=20;
> > > > $result=$temp1+$temp2;
> > > > return "The result of this function is: " . $result;
> > > > }
> > > > ?>
> > > > <A HREF="#" onclick="javascript:alert('<?=joe()?>')">calculate
foo</a>
> > > > </HTML>
> > > >
> > > > but really, I can't understand why you wouldn't just do:
> > > >
> > > > <HTML>
> > > > <?
> > > > $result=$temp1+$temp2;
> > > > echo "Total: {$result}";
> > > > ?>
> > > > </HTML>
> > > >
> > > > Why do they have to click?
> > > >
> > > >
> > > > You'll have to check all the javascript stuff and maybe massage it,
> > because
> > > > I haven't tested this, and haven't written much JS in the past
coupla
> > years.
> > > >
> > > >
> > > > Beware of the limitations of relying on javascript for anything
though
> > :)
> > > >
> > > >
> > > > Justin French
> > > >
> > > >
> > > > --
> > > > 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
> >
> >
>
attached mail follows:
--Original Message Text---
From: Michael
Date: Fri, 26 Jul 2002 21:09:13 -0500 (EST)
Hi, everyone.
There MUST be some creative way to call a user-defined PHP function from
an <a href> tag. Does anyone have any suggestions?
For example:
======================================================================
"> Click here to start "function joe()".
======================================================================
So, if the user clicks on the link, he'll see: "The result of this
function is: 20"
Any ideas? Any help would be VERY much appreciated. Thanks!
-- Michael
It is not possible to do it in one step.
The web server parses ALL the PHP code, generates HTML, sends it to the browser.
attached mail follows:
Check out http://www.faqts.com/knowledge_base/view.phtml/aid/277/fid/40
Essentially you'll want to use this this combined with get variables hard
coded into your url. For example:
<a href="script.php?action=function1">function 1</a>
<a href="script.php?action=function2">function 2</a>
At 11:13 PM 7/26/2002 -0400, Bob Lockie wrote:
>--Original Message Text---
>From: Michael
>Date: Fri, 26 Jul 2002 21:09:13 -0500 (EST)
>
>
>Hi, everyone.
>
>There MUST be some creative way to call a user-defined PHP function from
>an <a href> tag. Does anyone have any suggestions?
>
>For example:
>
>======================================================================
>"> Click here to start "function joe()".
>======================================================================
>
>So, if the user clicks on the link, he'll see: "The result of this
>function is: 20"
>
>Any ideas? Any help would be VERY much appreciated. Thanks!
>
>-- Michael
>
>
>It is not possible to do it in one step.
>The web server parses ALL the PHP code, generates HTML, sends it to the
>browser.
attached mail follows:
You can make the radio button submit the form... or you can actually make
the link a form and make it an "onClick" scenario to submit data. You can
simply do this like this (untested, but the idea works!):
<SCRIPT LANGUAGE="Javascript">
<!--
function CallFunc(CallME)
{
document.NoOneReallyCares.FuncToCall.value = CallME;
document.NoOneReallyCares.submit(); // there might be one step I've
forgotten on this object
}
//-->
</SCRIPT>
<FORM NAME="NoOneReallyCares" ACTION="functions.php" METHOD="POST">
<INPUT TYPE="hidden" NAME="FuncToCall" VALUE="">
<A HREF="javascript:void(CallFunc('functionnamehere'));"
onMouseOver="window.status='function.php';" onMouseOut="window.status='';">
</FORM>
"Michael" <mlee
ni-solutions.com> wrote in message
news:Pine.LNX.4.44.0207262151010.25873-100000
shiner.ni-solutions.com...
>
>
> Hmm.
>
> Hey, Mathieu. Many thanks for the reply. However, I currently AM using a
> form. What I'm trying to get away from, is the two step process:
>
> 1. pick your option
> 2. click submit
>
> I'm trying to get a one-step process, where the user can click on a link,
> and that calls the function.
>
> JavaScript won't work, because it's client side, and can't be used to call
> a server-side php function (unless you tell me some neat trick I don't
> know about yet). See my struggle now?
>
>
>
>
> On Fri, 26 Jul 2002, Mathieu Dumoulin wrote:
>
> > Date: Fri, 26 Jul 2002 21:46:00 -0400
> > From: Mathieu Dumoulin <mdumoulin
groupimage.com>
> > To: php-general
lists.php.net
> > Subject: Re: [PHP] calling user-defined php functions from <a href> tag
> >
> > Easy
> >
> > Your form when pressed the button submit will send the data from the
form
> > via post (Which is the best method) to the functions.php with all the
> > functions. What you need to modify now is that all the <input
type=radio>
> > need to be modified to "FuncToExec" name.
> >
> > When you receive the input of the form, you just verify what $FuncToExec
is
> > and execute the correct function.
> >
> > <?php
> >
> > if($FuncToExec == "joe"){
> > joe();
> > }elseif(...){
> > }
> >
> > ... (All functions in your file goes there)...
> >
> > ?>
> >
> > Now what you also want to add is that if your JOE function is to return
> > something, the IF ELSE calling that thing should intercept the value
> > returned and this part of the script should either do something with
that
> > value or just redirect the value to another script by GET mode:
> >
> > header("location: myresultpage.php?result=$result");
> >
> > There, sorted that out right?
> >
> > have fun
> > insanecoder!
> >
> > "Michael" <mlee
ni-solutions.com> wrote in message
> > news:Pine.LNX.4.44.0207262140050.25862-100000
shiner.ni-solutions.com...
> > >
> > >
> > > Hi, Justin.
> > >
> > > Thanks very much for the reponse.
> > > Yeah, this is a SUPER simplified form of my question, so please don't
> > > expect it to make sense. Heh.
> > >
> > > Basically, I have a php file with dozens of functions in it. I want
ONE of
> > > them to get called when a link is clicked.
> > >
> > > Currently, I achieve this with the use of HTML forms. My form
generates a
> > > list of options. And the user has to select an option, then click the
> > > SUBMIT button.
> > >
> > > But I want to make it a one-step process, whereby the user only needs
to
> > > click on the option.
> > >
> > > Of course, you can't achieve this in a form with JavaScript, but the
> > > JavaScript code won't let me execute a server-side php function
> > > (obviously).
> > >
> > > And I don't want to just shoot the link off to another page (even
though
> > > that's what it was designed to do). I want to call a very specific
> > > function.
> > >
> > > Tricky, I know. :(
> > >
> > > -- Michael
> > >
> > > On Sat, 27 Jul 2002, Justin French wrote:
> > >
> > > > Date: Sat, 27 Jul 2002 11:35:23 +1000
> > > > From: Justin French <justin
indent.com.au>
> > > > To: Michael <mlee
ni-solutions.com>, php-general
lists.php.net
> > > > Subject: Re: [PHP] calling user-defined php functions from <a href>
tag
> > > >
> > > > on 27/07/02 12:09 PM, Michael (mlee
ni-solutions.com) wrote:
> > > >
> > > > > <?php
> > > > > function joe() {
> > > > > $temp1=10;
> > > > > $temp2=20;
> > > > > $result=$temp1+$temp2;
> > > > > echo "The result of this function is: " . $result;
> > > > > }
> > > > > ?>
> > > >
> > > > wouldn't that be
> > > >
> > > > return "The result of this function is: " . $result;
> > > >
> > > > rather than echo?
> > > >
> > > >
> > > > Anyhoo, you haven't specified HOW you want to communicate the result
of
> > the
> > > > function to the browser.
> > > >
> > > > A HREF is supposed to take you off to another page (amongst other
> > things),
> > > > which might be what you're after.
> > > >
> > > > JavaScript (*shudder*) is designed to provide client-side actions,
so
> > maybe
> > > > a javascript alert is what you want, or a pop-up window, or who
knows
> > what.
> > > >
> > > > You need to decide what happens, in a story board fashion.
> > > >
> > > >
> > > > Remember, everything in PHP code takes place on the server, BEFORE
the
> > > > browser gets it.
> > > >
> > > >
> > > > Example of using JS alert:
> > > >
> > > > <HTML>
> > > > <?
> > > > function joe() {
> > > > $temp1=10;
> > > > $temp2=20;
> > > > $result=$temp1+$temp2;
> > > > return "The result of this function is: " . $result;
> > > > }
> > > > ?>
> > > > <A HREF="#" onclick="javascript:alert('<?=joe()?>')">calculate
foo</a>
> > > > </HTML>
> > > >
> > > > but really, I can't understand why you wouldn't just do:
> > > >
> > > > <HTML>
> > > > <?
> > > > $result=$temp1+$temp2;
> > > > echo "Total: {$result}";
> > > > ?>
> > > > </HTML>
> > > >
> > > > Why do they have to click?
> > > >
> > > >
> > > > You'll have to check all the javascript stuff and maybe massage it,
> > because
> > > > I haven't tested this, and haven't written much JS in the past
coupla
> > years.
> > > >
> > > >
> > > > Beware of the limitations of relying on javascript for anything
though
> > :)
> > > >
> > > >
> > > > Justin French
> > > >
> > > >
> > > > --
> > > > 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
> >
> >
>
attached mail follows:
So you want to load Page A, click on a link, stay on Page A, but execute a
function located in a script on Page B, without leaving A????
I've never done it, but I believe you call a javascript function which can
do it I think... maybe it's a POST form... sorry I can't be more help, but
I've never needed to do it.
If you can live with the page refreshing, then there's heaps of options.
Justin
on 27/07/02 12:43 PM, Michael (mlee
ni-solutions.com) wrote:
>
>
> Hi, Justin.
>
> Thanks very much for the reponse.
> Yeah, this is a SUPER simplified form of my question, so please don't
> expect it to make sense. Heh.
>
> Basically, I have a php file with dozens of functions in it. I want ONE of
> them to get called when a link is clicked.
>
> Currently, I achieve this with the use of HTML forms. My form generates a
> list of options. And the user has to select an option, then click the
> SUBMIT button.
>
> But I want to make it a one-step process, whereby the user only needs to
> click on the option.
>
> Of course, you can't achieve this in a form with JavaScript, but the
> JavaScript code won't let me execute a server-side php function
> (obviously).
>
> And I don't want to just shoot the link off to another page (even though
> that's what it was designed to do). I want to call a very specific
> function.
>
> Tricky, I know. :(
>
> -- Michael
>
> On Sat, 27 Jul 2002, Justin French wrote:
>
>> Date: Sat, 27 Jul 2002 11:35:23 +1000
>> From: Justin French <justin
indent.com.au>
>> To: Michael <mlee
ni-solutions.com>, php-general
lists.php.net
>> Subject: Re: [PHP] calling user-defined php functions from <a href> tag
>>
>> on 27/07/02 12:09 PM, Michael (mlee
ni-solutions.com) wrote:
>>
>>> <?php
>>> function joe() {
>>> $temp1=10;
>>> $temp2=20;
>>> $result=$temp1+$temp2;
>>> echo "The result of this function is: " . $result;
>>> }
>>> ?>
>>
>> wouldn't that be
>>
>> return "The result of this function is: " . $result;
>>
>> rather than echo?
>>
>>
>> Anyhoo, you haven't specified HOW you want to communicate the result of the
>> function to the browser.
>>
>> A HREF is supposed to take you off to another page (amongst other things),
>> which might be what you're after.
>>
>> JavaScript (*shudder*) is designed to provide client-side actions, so maybe
>> a javascript alert is what you want, or a pop-up window, or who knows what.
>>
>> You need to decide what happens, in a story board fashion.
>>
>>
>> Remember, everything in PHP code takes place on the server, BEFORE the
>> browser gets it.
>>
>>
>> Example of using JS alert:
>>
>> <HTML>
>> <?
>> function joe() {
>> $temp1=10;
>> $temp2=20;
>> $result=$temp1+$temp2;
>> return "The result of this function is: " . $result;
>> }
>> ?>
>> <A HREF="#" onclick="javascript:alert('<?=joe()?>')">calculate foo</a>
>> </HTML>
>>
>> but really, I can't understand why you wouldn't just do:
>>
>> <HTML>
>> <?
>> $result=$temp1+$temp2;
>> echo "Total: {$result}";
>> ?>
>> </HTML>
>>
>> Why do they have to click?
>>
>>
>> You'll have to check all the javascript stuff and maybe massage it, because
>> I haven't tested this, and haven't written much JS in the past coupla years.
>>
>>
>> Beware of the limitations of relying on javascript for anything though :)
>>
>>
>> Justin French
>>
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>
attached mail follows:
Ok, here i made a function that can accept an unknown number of params.
In fact, it's a data interface for a mysql database, when i call the
object's constructor it is in possibility to pass any number of table names
from 1 to x. Now i got this other class called a data interfacer which sends
a certain number of tables to the data interface constructor. I tried doing:
$interface = new data_interface($table1, eval("$table2, $table3, $table4"));
$interface = eval("new data_interface($table1, $table2, $table3, $table4)");
and various other tries. The thing is i can't know how many tables can be
transfered from the data interfacer to the data_interface. So i could make a
if..elseif...elseif until i reach something like 10 tables but still, it's
not a good practice, i'm sure there is a way to emulate real parameters when
they are needed and skip them in the call if you don't have them.
Can anybody help me out?
InsaneCoder
attached mail follows:
Hi,
Saturday, July 27, 2002, 11:38:44 AM, you wrote:
MD> Ok, here i made a function that can accept an unknown number of params.
MD> In fact, it's a data interface for a mysql database, when i call the
MD> object's constructor it is in possibility to pass any number of table names
MD> from 1 to x. Now i got this other class called a data interfacer which sends
MD> a certain number of tables to the data interface constructor. I tried doing:
MD> $interface = new data_interface($table1, eval("$table2, $table3, $table4"));
MD> $interface = eval("new data_interface($table1, $table2, $table3, $table4)");
MD> and various other tries. The thing is i can't know how many tables can be
MD> transfered from the data interfacer to the data_interface. So i could make a
MD> if..elseif...elseif until i reach something like 10 tables but still, it's
MD> not a good practice, i'm sure there is a way to emulate real parameters when
MD> they are needed and skip them in the call if you don't have them.
MD> Can anybody help me out?
MD> InsaneCoder
Send the table list as an array then use count($array) to find out how
many in the list or just do a while loop on it.
-- regards, Tom
attached mail follows:
> Hey, thanks for the reply. But I have multiple functions on one page (and > I need to keep it that way, because of all the variables I'm passing > around between them), so I can't just have the link call a new php file. I > need it to somehow call a function within the page.
Okay, do you understand, though, that PHP is server side and the browser is client side. PHP happens first, to generate the HTML code, that's evaluated in the browser on the client side. Once PHP generates the HTML code, it can't do anything else. It will take another page refresh or request to invoke PHP again.
That being said, in your href link, pass an ID saying which function to call. It can be the name of the function, or a number to relate to it. Make the action of the page the current page.
Maybe something like this is what you're after??
<? switch($_GET['ID']) { case 1: echo function_one(); break; case 2: echo function_two(); break; default: echo "<a href='" . $_SERVER['SCRIPT_NAME'] . "?ID=1'>Run Function One</a>"; echo "<a href='" . $_SERVER['SCRIPT_NAME'] . "?ID=2'>Run Function Two</a>"; } ?>
---John Holmes...
attached mail follows:
Thank You.
-- JJ Harrison webmastertececo.com www.tececo.com
"René moonen" <rene.moonen
oberthur.nl> wrote in message news:3D411EAC.80704
oberthur.nl... > JJ Harrison wrote: > > >is it possible to have optional values in a PHP function? > > > >some of the built in ones have optional parameters. > > > > > >-- > >JJ Harrison > >webmaster
tececo.com > >www.tececo.com > > > > > > > > > > > http://www.php.net/manual/en/functions.arguments.php > look at section 'Default argument values' > > > René > > >
attached mail follows:
I run an online gaming fansite, and most people that visit my site want to know what would be best to raise their skill on. I started a script which basically takes numeric data (0-120) and pulls the information they need from my database. I got the easy part down, which you can see here:
http://www.tamingarchive.com/main/whattotame.php
The complete listing of everything within the database is listed here:
http://www.tamingarchive.com/tameables/
Basically, the script pulls the animals from the database based on their "min" value. Problem is when multiple people use the same animal for skill. If Joe tames it, it might be 59.1 required skill, but if Bob comes and retames it, it takes 63.9 skill (+4.9). I need to be able to somehow add creatures into my array that I just pulled from the database with the necessary amount added to the "min" value and sort it all by the "min" value. My desired output would be like this:
Rat -0.9 Sewer Rat -0.9 Cow 11.1 Rat (2nd) 3.9 Sewer Rat (2nd) 3.9 Cow (2nd) 15.9 Rat (3rd) 18.3 Sewer Rat (3rd) 18.3
My select statement just does multiple OR comparisons to see if adding the 2nd & 3rd retame values to the "min" value will still put it within my desired range. The "quality" part of the script is just a comparison on the "min" value.
I don't even know where to begin to add these modified values to my array. I'm awful with arrays anyway. Any help would be greatly appreciated.
sasha
attached mail follows:
Ahhh, good old UO. I remember GMing my taming, crazy what they've done to the game since I've quit (120 skill, insane!).
I'm not completely sure of a few things about your question and I think that I could help if you supply the answers to my questions.
Does one tamer's taming of an animal increase ALL animals by a generic amount (i.e., John tames "a cow" for the first time, then Bill tames it, then John tames "a polar bear" for the first time and, again, Bill retames it; do both examples raise the requirement 9.8 points or is it based on the animal)?
If it is generic the answer is simple, if not, it might get a little more complicated.
"Spam" <spam
bittersweet2.com> wrote in message
news:1103_1027739971
news.php.net...
> I run an online gaming fansite, and most people that
> visit my site want to know what would be best to raise
> their skill on. I started a script which basically
> takes numeric data (0-120) and pulls the information
> they need from my database. I got the easy part down,
> which you can see here:
>
> http://www.tamingarchive.com/main/whattotame.php
>
> The complete listing of everything within the database
> is listed here:
>
> http://www.tamingarchive.com/tameables/
>
> Basically, the script pulls the animals from the
> database based on their "min" value. Problem is when
> multiple people use the same animal for skill. If Joe
> tames it, it might be 59.1 required skill, but if Bob
> comes and retames it, it takes 63.9 skill (+4.9). I
> need to be able to somehow add creatures into my array
> that I just pulled from the database with the
> necessary amount added to the "min" value and sort it
> all by the "min" value. My desired output would be
> like this:
>
> Rat -0.9
> Sewer Rat -0.9
> Cow 11.1
> Rat (2nd) 3.9
> Sewer Rat (2nd) 3.9
> Cow (2nd) 15.9
> Rat (3rd) 18.3
> Sewer Rat (3rd) 18.3
>
> My select statement just does multiple OR comparisons
> to see if adding the 2nd & 3rd retame values to the
> "min" value will still put it within my desired range.
> The "quality" part of the script is just a comparison
> on the "min" value.
>
> I don't even know where to begin to add these modified
> values to my array. I'm awful with arrays anyway.
> Any help would be greatly appreciated.
>
> sasha
>
>
attached mail follows:
Thanks for responding. It turns out this is a known bug in 4.2.2 along with Apache 2.x.x according to the developers. The CVS snapshots seem to work, but I have moved back to Apache 1.3.x from the 2.x.x stuff.
http://groups.google.com/groups?q=php+4.2.2+cookie+bug&ie=UTF-8&oe=UTF-8&hl= en
So watch out for 4.2.2 if you use Apache 2.x.x. It seems to be okay with Apache 1.3.26.
John
> -----Original Message-----
> From: Richard Lynch [mailto:rich
phpbootcamp.com]
> Sent: Friday, July 26, 2002 12:33 PM
> To: John S. Huggins
> Cc: php-general
lists.php.net
> Subject: [PHP] Re: Cookies
>
>
> >
> >Say it is not so.
> >
> >I hear the PHP 4.2.2 will only set the last cookie delivered by a browser
> >to a variable in the PHP environment.
> >
> >Is this true?
>
> Huh?
>
> Do you mean "last cookie of the same NAME" maybe?
>
> Because that's probably quite likely, and within 'spec' for the
> Cookie Spec.
>
> They will all be in an array $_COOKIE['foo'] rather than as a
> global $foo by
> default -- You can change that in php.ini if you don't care about
> security,
> which is a Bad Idea, but might be what you have to do until you convert...
>
> --
> Like Music? http://l-i-e.com/artists.htm
> I'm looking for a PRO QUALITY two-input sound card supported by Linux (any
> major distro). Need to record live events (mixed already) to stereo
> CD-quality. Soundcard Recommendations?
> Software to handle the recording? Don't need fancy mixer stuff. Zero (0)
> post-production time. Just raw PCM/WAV/AIFF 16+ bit, 44.1KHz, Stereo
> audio-to-disk.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
attached mail follows:
Hi,
Using the following code snippet
function doHead() { header("Last-Modified: " . gmdate("D, d M Y H:i:s", getlastmod()) . " GMT"); if (func_num_args() == 2) { doTitle(func_get_arg(0), func_get_arg(1)); } else { doTitle(func_get_arg(0)); }
if I pass 2 argument into the function then I get the following error * Fatal error*: func_get_arg(): Can't be used as a function parameter
but passing 1 argument is ok as is using the following code with 2 arguments
function doHead() { header("Last-Modified: " . gmdate("D, d M Y H:i:s", getlastmod()) . " GMT"); if (func_num_args() == 2) { $a = func_get_arg(0); $b = func_get_arg(1); doTitle($a, $b); } else { doTitle(func_get_arg(0)); }
Is there a particualr reason for this or is it a bug? PHP/4.1.2 on Debian Stable (PowerPC)
/James
-- Technology is a word that describes something that doesn't work yet. Douglas Adams
attached mail follows:
It must simply be a bug (probably confusing the function doTitle by calling it, it might thinking you're requesting its info the second pass? Don't know why, but it's a possibility)...
"James Nord" <teilo
cdt.luth.se> wrote in message
news:3D42184E.1070101
cdt.luth.se...
> Hi,
>
> Using the following code snippet
>
> function doHead() {
> header("Last-Modified: " . gmdate("D, d M Y H:i:s",
> getlastmod()) . " GMT");
> if (func_num_args() == 2) {
> doTitle(func_get_arg(0), func_get_arg(1));
> }
> else {
> doTitle(func_get_arg(0));
> }
>
> if I pass 2 argument into the function then I get the following error
> *
> Fatal error*: func_get_arg(): Can't be used as a function parameter
>
>
> but passing 1 argument is ok as is using the following code with 2
arguments
>
> function doHead() {
> header("Last-Modified: " . gmdate("D, d M Y H:i:s",
> getlastmod()) . " GMT");
> if (func_num_args() == 2) {
> $a = func_get_arg(0);
> $b = func_get_arg(1);
> doTitle($a, $b);
> }
> else {
> doTitle(func_get_arg(0));
> }
>
> Is there a particualr reason for this or is it a bug? PHP/4.1.2 on
> Debian Stable (PowerPC)
>
> /James
>
> --
> Technology is a word that describes something that doesn't work yet.
> Douglas Adams
>
>
>
attached mail follows:
On Saturday 27 July 2002 06:02, Joel Lopez wrote: > I installed PHP when I installed Red Hat 7.2 without MySQL. I have now > added MySQL but I can't figure out how to enable it in PHP. Can anyone > help?
Installed from RPM or source?
-- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development */* Q: What do you call a blind pre-historic animal? A: Diyathinkhesaurus.
Q: What do you call a blind pre-historic animal with a dog? A: Diyathinkhesaurus Rex. */
attached mail follows:
If someone enters this into a field...
New York "City"
and I need to re-display it in the field (if an error occurred, for example), this is what's in the field...
New York \
I have another multi-line text field that I used quotes in and this doesn't happen with that field, even though they are both being treated in the same manner. What am I missing?
attached mail follows:
http://www.php.net/manual/en/function.stripslashes.php Check that out, it might help.
"Monty" <monty3
hotmail.com> wrote in message
news:B9679BD5.1242A%monty3
hotmail.com...
> If someone enters this into a field...
>
> New York "City"
>
> and I need to re-display it in the field (if an error occurred, for
> example), this is what's in the field...
>
> New York \
>
> I have another multi-line text field that I used quotes in and this
doesn't
> happen with that field, even though they are both being treated in the
same
> manner. What am I missing?
>
attached mail follows:
if you're using Apache, try creating an .htaccess file with this line in it: php_value magic_quotes_gpc 1
"Monty" <monty3
hotmail.com> wrote in message
news:B9679BD5.1242A%monty3
hotmail.com...
> If someone enters this into a field...
>
> New York "City"
>
> and I need to re-display it in the field (if an error occurred, for
> example), this is what's in the field...
>
> New York \
>
> I have another multi-line text field that I used quotes in and this
doesn't
> happen with that field, even though they are both being treated in the
same
> manner. What am I missing?
>
attached mail follows:
MySQL support is now built in Php. So all you have to do is start using it...
Any problems try editing the php.ini to give a little extra conguration for mySQL..
Lord Loh.
attached mail follows:
> > > for($m=1;$m<=5;$m++){ > > > $div_idd[$m]=${'row->sub' . $m . 'd'}; > > > }
I'm not sure if it will work, but you might try either using the mysql_fetch_array($result); function and then refer to them by $row["src1d"]; or try $div_idd[$m] = $row->$$name; where $name = "sub" . $m . "d"; I'm not sure if that will work, but it might be worth a try.
--------------------------------------
"Steve Buehler" <steve
vespro.com> wrote in message
news:5.1.0.14.2.20020726161915.00b89b08
vespro.com...
> Ok. That makes since.
>
> Thanks
> Steve
> > At 04:20 PM 7/26/2002 -0500, you wrote:
> >var names can only be letters, numbers, and underscores.
> >
> >Jim Grill
> >Support
> >Web-1 Hosting
> >http://www.web-1hosting.net
> >----- Original Message -----
> >From: "Steve Buehler" <steve
vespro.com>
> >To: "PHP" <php-general
lists.php.net>
> >Sent: Friday, July 26, 2002 3:53 PM
> >Subject: [PHP] filling an array(2)
> >
> >
> > > hmmmm. Ok. Can somebody explain this one? Why won't it work
correctly?
> > >
> > > for($m=1;$m<=5;$m++){
> > > $div_idd[$m]=${'row->sub' . $m . 'd'};
> > > }
> > >
> > > Can it not be done with a 3 parter? The columns in the table that
$row
> > > gets, are sub1d, sub2d, sub3d, sub4d and sub5d. Or is it the "->"
that is
> > > messing it up? I have tried escaping them "row\-\>sub", but that
didn't
> >work.
> > > What would I search for on the PHP site or where are directions
located
> > > that tells me how to use this type of putting a variable together. It
> > > makes it hard to search for it if I don't know what it is called.
> > >
> > > Thanks
> > > Steve
> > >
> > >
> > > --
> > > This message has been scanned for viruses and
> > > dangerous content by MailScanner, and is
> > > believed to be clean.
> > > ow3
> > >
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> > >
> > >
> >
> >
> >
> >--
> >This message has been scanned for viruses and
> >dangerous content by MailScanner, and is
> >believed to be clean.
> >ow3
>
>
>
> --
> This message has been scanned for viruses and
> dangerous content by MailScanner, and is
> believed to be clean.
> ow3
>
attached mail follows:
You can do what he said or just put a separate loop inside the original loop.
Depending on how you get the info, you can use either way (his would create less overhead if you are just using the same <TD> info every row, otherwise they're really the same because his way you'll have to create an array to access later for multiple rows, or just do my way and have the loop access the NEXT *3* (or whatever) items ...).
i.e., for (LOOP FOR <TR>) { for (LOOP FOR <TD>) {} }
"César aracena" <icaam
icaam.com.ar> wrote in message
news:001a01c234f0$a5e8ad80$28ed0dd1
gateway...
Hi all.
Last nite I've came across a problem I wasn't able to figure out by my self. It's not difficult to make a loop that will make new *TABLE ROWS* (<tr>) to show several DB objects in a nice way. what I need to do, is to display 2 or maybe even 3 of this objects stored in a DB per table row, separated in different *TABLE COLUMS* (<td>). how can I achieve this? What I usually do is:
------------------------------ // DB QUERY $query = "SELECT * FROM table_name"; $result = mysql_query($query) or die(mysql_error()); $num_rows = mysql_num_rows($result);
// NOW THE LOOP for ($i=0; $i<$num_rows; $i++) { $row = mysql_fetch_array($result); echo "<tr>"; echo "<td>"; echo $row[whatever]; echo "</td>"; echo "</tr>"; } ------------------------------
but how can I get 2 or 3 columns displaying different db objects? A loop inside a loop?
Thanks in advance,
<mailto:webmaster
icaam.com.ar> Cesar Aracena
CE / MCSE+I
Neuquen, Argentina
+54.299.6356688
+54.299.4466621
attached mail follows:
In order to open an encrypted socket using fsockopen(), I downloaded and built the latest snapshot from snaps.php.net. It works great on my FreeBSD box - however, now I need to run the code on a Windows server. When I try, though, I receive this error message:
Warning: fsockopen(): no SSL support in this build in c:\inetpub\wwwroot\robot\robotclient.php4 on line 28
From skimming through the source, it appears this means that the binary was built on a computer without OpenSSL support - does anyone know where I can get a binary for Windows that was built with OpenSSL?
Thanks in advance, Josh Levine
attached mail follows:
Sorry,
I really have tried to fix this.
I get a parse error on line 24(see comment in script)
*Any Way* Here is the script.
function view_post($tid){ $query = 'select forum_post.name, forum_post.time, forum_post.uid, forum_post.message, priv_user.username from forum_post, priv_user where forum_post.uid = priv_user.uid AND forum_post.tid = '.$tid.'; $result = mysql_query($query) or die("Query failed: $query<br>" . mysql_error()); $num_results = mysql_num_rows($result);
for ($i=0; $i < $num_results; $i++) { $row = mysql_fetch_array($result); echo $row['name'].' '.date('jS-M-Y',$row['time']).' '.$row['username']."\n<br>"; // Parse error here - line 24 echo $row['message']."\n<br>"; }
}
I am getting really frustrated. I know I really shouldn't use the mailing list for debugging. My editors not showing anything obvious with syntax highlighting.
-- JJ Harrison webmastertececo.com www.tececo.com
attached mail follows:
I think the Parse error might actually be on the last line of your query ( the " .'; "). I tested that on my page and if I put in the query, as is, it gave me a parse error. Without the ending .' it was okay though.
> function view_post($tid){ ______________________________________________ > $query = 'select forum_post.name, forum_post.time, forum_post.uid, > forum_post.message, priv_user.username from forum_post, priv_user where > forum_post.uid = priv_user.uid AND forum_post.tid = '.$tid.'; // HERE ______________________________________________ > $result = mysql_query($query) or die("Query failed: $query<br>" . > mysql_error()); > $num_results = mysql_num_rows($result); > > for ($i=0; $i < $num_results; $i++) > { > $row = mysql_fetch_array($result); > echo $row['name'].' '.date('jS-M-Y',$row['time']).' > '.$row['username']."\n<br>"; // Parse error here - line 24 > echo $row['message']."\n<br>"; > } > > }
attached mail follows:
Thanks.
I've never seen an error that far up from the qouted line.
-- JJ Harrison webmastertececo.com www.tececo.com
"Chris Earle" <chris
earleweb.com> wrote in message news:20020727080112.44351.qmail
pb1.pair.com... > I think the Parse error might actually be on the last line of your query ( > the " .'; "). I tested that on my page and if I put in the query, as is, it > gave me a parse error. Without the ending .' it was okay though. > > > function view_post($tid){ > ______________________________________________ > > $query = 'select forum_post.name, forum_post.time, forum_post.uid, > > forum_post.message, priv_user.username from forum_post, priv_user where > > forum_post.uid = priv_user.uid AND forum_post.tid = '.$tid.'; // HERE > ______________________________________________ > > $result = mysql_query($query) or die("Query failed: $query<br>" . > > mysql_error()); > > $num_results = mysql_num_rows($result); > > > > for ($i=0; $i < $num_results; $i++) > > { > > $row = mysql_fetch_array($result); > > echo $row['name'].' '.date('jS-M-Y',$row['time']).' > > '.$row['username']."\n<br>"; // Parse error here - line 24 > > echo $row['message']."\n<br>"; > > } > > > > } > >
attached mail follows:
Is it possible download php scripts from webpages ? for example i need php.net scripts or others :-) If yes, how ?
attached mail follows:
You can't download a script when it is being parsed.
If it is not going to be parsed you can download it as text.
as for php.net , they have got a button on their site called: showsource
click it and have the source of any page you want,
"Apollo" <apollo
aktv.lt> wrote in message
news:20020727064130.11554.qmail
pb1.pair.com...
> Is it possible download php scripts from webpages ? for example i need
> php.net scripts or others :-) If yes, how ?
>
>
attached mail follows:
No. Since PHP is executed on the server, the only thing that is sent to the browser is pure HTML (and client-sided scripts like JavaScript).
This means you cannot just get the source code of a PHP page by just browsing it.
/lasso (lasso
lassoweb.nu)
Apollo wrote: > Is it possible download php scripts from webpages ? for example i need > php.net scripts or others :-) If yes, how ? > >
attached mail follows:
i am using IE
"Julio Nobrega" <inerte
hotmail.com> wrote in message
news:20020726142402.90164.qmail
pb1.pair.com...
> Electroteque em Friday 26 July 2002 11:19 foi agraciado com uma resposta
> por:
>
> > hi guys i am having major caching issues in phpMyAdmin when i moved to
> > apache 2.0.39 has anyone else expeirence this ? its sending me round the
> > bend , i cant view my mysql tables when i create them , i have to
removed
> > temp internet files and hit refresh to get them to view
>
> Yes! But only with the Opera navigator, and while using localhost. With
> Internet Explorer, doesn't happen.
>
> --
> --
> http://gnet.inerciasensorial.com.br
attached mail follows:
geez i thought they had it right this time , i had the same problem with php
4.2.1 , i downloaded the latest snapshot and just copied over the
php_functions.c from there and the install worked after that
"Bob Lockie" <bjlockie
lockie.ca> wrote in message
news:200207261536.g6QFaaob016764
gw.lockie.ca...
>
> >Hello again..
> >
> >I have another compile problem, I'm wondering if someone
> >can help me. I've built and installed Apache 2.0.39 and am recompiling
> >PHP4.2.2. Below are the details..
> >
> >./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-zlib=/usr
> >--with-oci8=`dbhome`
> >
> >Compiling...
> >Entering director '/php-4.2.2/sapi/apache2filter'
> >/bin/sh /php-4.2.2/libtool --silent --mode=compile gcc -I.
> >-I/php4.2.2/sapi/apache2filter -I/php4.2.2/main -I/php-4.2.2
> >-I/usr/local/apache2/include -I/php-4.2.2/Zend
> >-I/php-4.2.2/ext/mysql/libmysql
> >-I/export/home/oracleuser/OraHome1/rdbms/public
> >-I/export/home/oracleuser/OraHome1/rdbms/demo -I/php-4.2.2/ext/xml/expat
> >-D_POSIX_PTHREAD_SEMANTICS -D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT
> >-I/php-4.2.2/TSRM -DTHREAD=1 -g -O2 -pthreads -DZTS -prefer-pic -c
> >php_functions.c
> >php_functions.c:93:27: missing binary operator before '('
>
> Use Apache 1.3.26 with PHP 4.2.2.
> Apache 2 support is experimental at this time.
> If you really want to use Apache2, do a search on google.
>
>
>
attached mail follows:
You can use REPLACE instead of making two separate queries (UPDATE and INSERT) because it checks if it is there, and if it's not, then it adds it; otherwise it updates it. I think that's right ... but the SQL server's SQL server is broken! (the irony!)
That won't solve all of your problems, but it might help. Check up at www.mysql.com on how to use "REPLACE"
"Monty" <monty3
hotmail.com> wrote in message
news:B967286A.123B5%monty3
hotmail.com...
> I have two tables: member_basic and member_detail. When a member edits
their
> record, they can edit or add data for either table, but, the data stored
in
> member_detail isn't required, so, they can possibly leave these fields
> blank. By the way, both tables would be linked by a member id.
>
> Here's my dilemma: If they do fill in any fields associated with
> member_detail, I have to first see whether or not there's an entry in the
> member_detail table already for that user (based on member id number). If
> not, I then have to check ALL the form fields associated with this table
to
> see if any data was actually entered so I know whether or not to create a
> new record for the member in member_detail. If there is already an entry
for
> that member in member_detail, then I can just do a standard UPDATE.
>
> Now maybe this is how it has to be done, but, I was hoping there might be
an
> easier way to do this. It appears it's not possible to UPDATE a JOINed
table
> during a query, which is what I was hoping. I am trying to keep the DB
> efficient by keeping optional data that may be left empty in another
table,
> but, it's only making my life difficult, so, unless there's an easier way,
I
> may just combine all the fields into one table and be done with it.
>
> Sorry for the long-winded explanation. Any suggestion are greatly
> appreciated!
>
> Monty
>
>
>
>
attached mail follows:
you have to add: session_start() in your second file.
"Donpro" <donpro
lclcan.com> wrote in message
news:005001c234df$fe6e7b80$c889cdcd
lclcan.com...
> Hi,
>
> I have a form that calls a PHP script which sets a session variable and
> redirects to anopther URL as such:
>
> session_start();
> $HTTP_SESSION_VARS['userid'] = "someidnumber";
> Header('Location: ' . 'http://www.mydomain.com/welcome.html');
>
> On welcome.html, I have the following code:
>
> <script language="php">
> echo 'userid: ' . $HTTP_SESSION_VARS['userid'] . '<br/>';
> </script>
>
> When I run it in my browser, the value of 'userid' is empty. Anyone know
> why?
>
>
attached mail follows:
you can pass an unlimited number of variable through the array() constructor.
as:
data_interface(array($table1, $table2, $table3)) you can use an Array manipulation functions for that order too.
good luck,
"Mathieu Dumoulin" <mdumoulin
groupimage.com> wrote in message
news:20020727012052.51058.qmail
pb1.pair.com...
> Ok, here i made a function that can accept an unknown number of params.
>
> In fact, it's a data interface for a mysql database, when i call the
> object's constructor it is in possibility to pass any number of table
names
> from 1 to x. Now i got this other class called a data interfacer which
sends
> a certain number of tables to the data interface constructor. I tried
doing:
>
> $interface = new data_interface($table1, eval("$table2, $table3,
$table4"));
> $interface = eval("new data_interface($table1, $table2, $table3,
$table4)");
>
> and various other tries. The thing is i can't know how many tables can be
> transfered from the data interfacer to the data_interface. So i could make
a
> if..elseif...elseif until i reach something like 10 tables but still, it's
> not a good practice, i'm sure there is a way to emulate real parameters
when
> they are needed and skip them in the call if you don't have them.
>
> Can anybody help me out?
>
> InsaneCoder
>
>
attached mail follows:
No matter how much you compress you'll always come across the size grow problem.
try RAR (www.rarsoft.com) execute it from PHP when necessary.
good luck,
"Julio Nobrega" <inerte
hotmail.com> wrote in message
news:20020726191132.72162.qmail
pb1.pair.com...
> Hi all,
>
> I am serializing every get, post, cookie and server variables to log
them.
> I was using mysql to store this data, but I've generated with 900
pageviews
> a 5 (five) MB table. Now I am using the bz2 extension to accomplish this,
> but I am not sure if it's the best method.
>
> Are there any better alternatives? I must log this data for every
> requested page since it's for a bank application (ever had the Central
Bank
> of your country asking for log files? ;-)
>
> Thanks,
>
> Julio Nobrega
> http://gnet.inerciasensorial.com.br
attached mail follows:
Hello Uma,
Monday, July 22, 2002, 8:09:44 AM, you wrote:
UST> Hello,
UST> I need to display a value on the text box during onClick event where the UST> data is fetched from the database..I have given the code like this but it UST> is giving unterminated string constant..
UST> <input type=text name=text1 onClick=(dd.value="<? echo $correct; ?>");
UST> Can anyone please tell me how to solve this ...
UST> Thanks & Regards, UST> Uma
Hi,
Try to use: <input type="text" name="text1" onClick="dd.value='<? echo $correct; ?>';">
-- Best regards, Zoltan mailto:zolikonyveshome.ro
attached mail follows:
Hi, im making a tab/lyric portal, and for viewing tabs i want to display the time the lyric/tab was submitted. So I retrive it from a MySQL database (as a timestamp) and format it using the date function. The problem is, that the date: 19-01-2038 04:14:07 is allways returned, even though in the `date` field the timestamp says (as an actual example) 20020723200919.
Here is a shortened version of the script:
$link = mysql_connect($dbhost, $dbuser, $dbpass);
mysql_select_db($dbname, $link);
$get_resource = mysql_query("SELECT `artist_id`,`title`,`content`,`user_id`,`date`,`type`,`views` FROM `resources` WHERE `id` = $id");
$values = mysql_fetch_row($get_resource);
<?php $submitdate = date("d-m-Y H:i:s", $values[4]); echo("Submitted on $submitdate"); ?>
attached mail follows:
> Hi, im making a tab/lyric portal, and for viewing tabs i want to display the > time the lyric/tab was submitted. So I retrive it from a MySQL database (as > a timestamp) and format it using the date function. The problem is, that the > date: 19-01-2038 04:14:07 is allways returned, even though in the `date` > field the timestamp says (as an actual example) 20020723200919. > > Here is a shortened version of the script: > > <?php $submitdate = date("d-m-Y H:i:s", $values[4]); echo("Submitted on > $submitdate"); ?> >
Hi Tony,
the date() function in PHP does _only_ take UNIX timestamps as an argument which means that you can not run such a timestamp as the above.
I recommend that you have a look at http://www.mysql.com/doc/D/a/Date_and_time_functions.html which describes the built-in functions for date-handling in MySQL. A function to look at could be DATE_FORMAT().
Regards,
Jome
attached mail follows:
Yeh, ive allready looked at that before, but where and when do i use DATE_FORMAT() ? When im inserting the row or selecting it?
"Jome" <jome
emoj.net> wrote in message
news:20020727093525.8534.qmail
pb1.pair.com...
> > Hi, im making a tab/lyric portal, and for viewing tabs i want to display
> the
> > time the lyric/tab was submitted. So I retrive it from a MySQL database
> (as
> > a timestamp) and format it using the date function. The problem is, that
> the
> > date: 19-01-2038 04:14:07 is allways returned, even though in the `date`
> > field the timestamp says (as an actual example) 20020723200919.
> >
> > Here is a shortened version of the script:
> >
> > <?php $submitdate = date("d-m-Y H:i:s", $values[4]); echo("Submitted on
> > $submitdate"); ?>
> >
>
> Hi Tony,
>
> the date() function in PHP does _only_ take UNIX timestamps as an argument
> which means that you can not run such a timestamp as the above.
>
> I recommend that you have a look at
> http://www.mysql.com/doc/D/a/Date_and_time_functions.html which describes
> the built-in functions for date-handling in MySQL. A function to look at
> could be DATE_FORMAT().
>
> Regards,
>
> Jome
>
>
attached mail follows:
> Yeh, ive allready looked at that before, but where and when do i use > DATE_FORMAT() ? When im inserting the row or selecting it? >
Replace your existent query with this one and try:
SELECT `artist_id`,`title`,`content`,`user_id`,DATE_FORMAT(date,'%d-%m-%Y %H:%i:%s'),`type`,`views` FROM `resources` WHERE `id` = $id
Regards,
Jome
attached mail follows:
Alternativly you could store the dates as UNIX timestamps.
That is what I do. It is then eaiser to do certian things(ie show stuff released in the last month)
-- JJ Harrison webmastertececo.com www.tececo.com
"Tony Harrison" <tonyh21
tharrison21.fsnet.co.uk> wrote in message news:20020727093802.11015.qmail
pb1.pair.com... > Yeh, ive allready looked at that before, but where and when do i use > DATE_FORMAT() ? When im inserting the row or selecting it? > > "Jome" <jome
emoj.net> wrote in message > news:20020727093525.8534.qmail
pb1.pair.com... > > > Hi, im making a tab/lyric portal, and for viewing tabs i want to display > > the > > > time the lyric/tab was submitted. So I retrive it from a MySQL database > > (as > > > a timestamp) and format it using the date function. The problem is, that > > the > > > date: 19-01-2038 04:14:07 is allways returned, even though in the `date` > > > field the timestamp says (as an actual example) 20020723200919. > > > > > > Here is a shortened version of the script: > > > > > > <?php $submitdate = date("d-m-Y H:i:s", $values[4]); echo("Submitted on > > > $submitdate"); ?> > > > > > > > Hi Tony, > > > > the date() function in PHP does _only_ take UNIX timestamps as an argument > > which means that you can not run such a timestamp as the above. > > > > I recommend that you have a look at > > http://www.mysql.com/doc/D/a/Date_and_time_functions.html which describes > > the built-in functions for date-handling in MySQL. A function to look at > > could be DATE_FORMAT(). > > > > Regards, > > > > Jome > > > > > >
attached mail follows:
I tried using UNIX stamps but it dont work, and why the hell does it default to that date anyway? I thought it was supposed to default to the current time?
"Jj Harrison" <webmaster
tececo.com> wrote in message
news:20020727110851.54093.qmail
pb1.pair.com...
> Alternativly you could store the dates as UNIX timestamps.
>
> That is what I do. It is then eaiser to do certian things(ie show stuff
> released in the last month)
>
>
> --
> JJ Harrison
> webmaster
tececo.com
> www.tececo.com
>
> "Tony Harrison" <tonyh21
tharrison21.fsnet.co.uk> wrote in message
> news:20020727093802.11015.qmail
pb1.pair.com...
> > Yeh, ive allready looked at that before, but where and when do i use
> > DATE_FORMAT() ? When im inserting the row or selecting it?
> >
> > "Jome" <jome
emoj.net> wrote in message
> > news:20020727093525.8534.qmail
pb1.pair.com...
> > > > Hi, im making a tab/lyric portal, and for viewing tabs i want to
> display
> > > the
> > > > time the lyric/tab was submitted. So I retrive it from a MySQL
> database
> > > (as
> > > > a timestamp) and format it using the date function. The problem is,
> that
> > > the
> > > > date: 19-01-2038 04:14:07 is allways returned, even though in the
> `date`
> > > > field the timestamp says (as an actual example) 20020723200919.
> > > >
> > > > Here is a shortened version of the script:
> > > >
> > > > <?php $submitdate = date("d-m-Y H:i:s", $values[4]); echo("Submitted
> on
> > > > $submitdate"); ?>
> > > >
> > >
> > > Hi Tony,
> > >
> > > the date() function in PHP does _only_ take UNIX timestamps as an
> argument
> > > which means that you can not run such a timestamp as the above.
> > >
> > > I recommend that you have a look at
> > > http://www.mysql.com/doc/D/a/Date_and_time_functions.html which
> describes
> > > the built-in functions for date-handling in MySQL. A function to look
at
> > > could be DATE_FORMAT().
> > >
> > > Regards,
> > >
> > > Jome
> > >
> > >
> >
> >
>
>
attached mail follows:
I store all dates in unix timestamp format. It's the easiest one to work with, and it's easy to do things like "date + three days", because it's just a case of adding the right number of seconds to the current stamp.
You don't have to split anything, or get substr()'s of anything... and since date() accepts unix timestamps AND is the easiest way to get date formats (for me), I reckon it's the best way to go.
Justin
attached mail follows:
I've had problems in some graphics viewers opening JPEGs saved in progressive format. Maybe saving them at such high resolution (or interlaced) isn't part of the JPEG specifaction that GD uses.
"Oscarfm
Cantv.Net" <oscarfm
cantv.net> wrote in message
news:53670-22002752622243299
cantv.net...
> Hello,
>
> I am creating a script that takes an uploaded image, creates a thumbnail
> from it, and saves both files.
>
> The script works great, but the problem is, the files It will have to
> handle, are high-resolution files (300dpi, 24 bit-depth).. it works fine
on
> regular files (72 dpi), but when I upload a 300dpi image, it says that the
> image is not a valid JPEG file.
>
> Warning: imagecreatefromjpeg:
> '/home/sites/site1/web/uploadedHi-Res/mo_0001.jpg' is not a valid JPEG
file
> in /home/sites/site1/web/site/designers/doSubmit.php on line 6
>
> The image appears to be valid here, it opens on photoshop, and everywhere,
> however, once uploaded, the image seems to be corrupted somehow, bc if I
> download it again, it won¨t open anywhere. Has this happened to anyone
else
> on this list?.. if so, please advise!.
>
> Here is the code for the script if it helps:
>
>
> function createThumbnail($path, $filename) {
> $src_img=ImageCreateFromJpeg($path); //HERE IT SAYS IMAGE NOT VALID
> if (imagesx($src_img) > imagesy($src_img)) {
> $new_w=69;
> $new_h=40;
> $t1 = imagesx($src_img);
> $t2 = imagesy($src_img);
> } else {
> $new_w=40;
> $new_h=69;
> $t1 = imagesy($src_img);
> $t2 = imagesx($src_img);
> }
> header("Content-type: image/jpeg");
> $dst_img=imagecreate($new_w,$new_h);
> imagecopyresized($dst_img,$src_img,0,0,0,0,$new_w,$new_h,$t1,$t2);
> ImageJpeg($dst_img,
> "/home/sites/site1/web/uploadedHi-Res/$filename-thumb.jpg", 50);
> }
>
>
> if (($filename_type != "image/jpeg") && ($filename_type != "image/jpg") &&
> ($filename_type != "image/pjpeg")) {
> header("Location:submitError.php"); exit;
> } else {
> srand((double)microtime()*1000000);
> $randomfile = substr(md5(rand(0,9999999)), 0, 6);
> $upload = "/home/sites/site1/web/uploadedHi-Res";
> $upload_path = "$upload/$filename_name";
> if (is_uploaded_file($filename)) {
> Exec("cp $filename $upload_path");
> $link =
mysql_connect(localhost, 'xxxxx', 'xxxx')
> or die("Unable to Connect to Database");
> mysql_select_db(xxxx);
> $sql = "INSERT INTO xxxx VALUES ('$designer_valid', '$filename_name',
> NOW(), 'Pending')";
> $result = mysql_query($sql) or die("Query Failed");
> createThumbnail($upload_path, $filename_name);
> header("Location:designSubmitted.php"); exit;
> } else {
> header("Location:submitError.php"); exit;
> }
> }
>
>
attached mail follows:
Do you still get the cached version when you press the refresh button in the browser? Going back to a page will nearly always return a cached version of the page unless it was created as result of a form post.
"Evgeny Chuykov" <gecka
baik.ru> wrote in message
news:147600343808.20020726094818
baik.ru...
> Hi.
>
> I've tried this:
>
> header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
> header("Cache-control: private");
> header("Cache-control: no-cache");
> header("Cache-control: no-store");
> header("Cache-control: must-revalidate");
> header("Cache-control: proxy-revalidate");
> header("Cache-control: max-age=0");
> header("Pragma: no-cache");
>
> session_cache_limiter('private, must-revalidate');
> ( and session_cache_limiter('nocache') )
>
> But it doesn't work - winroute cache everything. Does anyone know any
> solution?
>
> --
> Best regards,
> Evgeny mailto:gecka
baik.ru
>
attached mail follows:
Hi,
I have search around on google/php.net to try and find a way to remove <body>, everything above ,</body> and everything below it in a html page.
eg.
<html> <head> <title>test</test> </head> <body> Blah Blah Blah<br> </body> </html>
would become: Blah Blah Blah<br>
I know how to use php to convert html to pure text etc but I don't know how to remove the unwanted header and footer HTML.
I am pretty sure that someone must have done it(HTML file uploads for sites etc).
Thanks in advance and good night.
-- JJ Harrison webmastertececo.com www.tececo.com
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]