* Thus wrote water_foul:
> i get the following error
> ----------------------------
> Parse error: parse error, unexpected T_STRING in
> C:\Inetpub\localroot\aichlmayr.net\sites\aaron\module\personal\links.php on
> line 21
I get parse error on line 4.. but then again I'm smarter than php's
parser.
> ----------------------------------
> for the following code and i cant figure out why (you may need to maxamise
> to read it right)
> --------------------------------------------
> <?php
> //the function for adding new addresses
> function loop_new_address($loopnum,$url,$name){
> //the ${'link' . $loopnum} says put $link and add $loopnum to the end
> if(isset(${'link' . $loopnum . '})){
extra quote, but I think you already found it.
For readability you might want to consider using a variable
variable:
$linkloop = 'link' . $loopnum;
if (isset($$linkloop)) {
...
> loop_new_adderss($loopnum+1,$url,$name);
> };
> else{
> setcookie("link" . $loopnum . "",$url,time()+3600*200);
If you're going to use double quotes might as put the variable
inside of them. but then again, with the readability fix above
you simpley have to do:
setcookie($linkloop, $url, time()+3600*200);
btw, it doesn't make much sense to have hard coded math, better off
just specifying the number and comment it:
time()+720000; // +200 hours
> print(<a href=$url>$name</a> was added);
This line, as well as others below, is absolutly illegal in php.
You must use quotes around strings! double quotes if variables
exist inside, single quotes if not.
> };
> if(isset($_GET[new])) {
> loop_new_address(1,$_GET[name],$_GET[url]);
Be sure to use $_GET['new']; // note the quotes
You're entering the another recursive loop, this is always
dangerous to have these thing dangling around everywhere :)
> ... <the reset clipped>
I see you are setting a lot of cookies, you might want to take a
look at (And be sure to read the part about limitations):
http://wp.netscape.com/newsref/std/cookie_spec.html
HTH your future programming :)
Curt
--
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about. No, sir. Our model is the trapezoid!
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php