ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I am an enthusiastic guy who loves PHP very much.So I bought a pretty expensive wrox Professional PHP4 programming book to learn.However,some code seems like having error. ...I hope you guys will point out the error and tell me why while I have no experience about PHP 4. (It doesn't accumulate 1 in order to keep track the visit time!)
************************************************************************
<?php
$accesses++;
setcookie("accesses",$accesses,time()+3600,"","",0);
?>
<html>
Thank you for visiting my site.You've seen this page
In my opinion PHP is still in its infancy and is only useful for web based interfaces. Hence the reason I use perl - it can be used for system tasks and web based scripting.
Just a thought. Is it really necessary for you to use cookies on your site? You might want to just look into using the session properties of php.
Basically all you need to do is have session_start(); as the first line on on your php page and you can then use the $_SESSION array to store/retrieve values from.
I never think that this post has many replies...It's great.
By the way,I know session is better than cookies while it will be stored at the server rather than user's hard drive.(And no user permission to do so )However,I just read that topic so I followed the tutorial.
And XavierP,I've checked out the errata page of this book(Professional PHP 4 from WROX),they don't include this errata.I definitely think that if you want to publish a book,you must check it again and again to see whether there are any error.Because it's a waste of time to check the errata from their website....
I appreciated every help,opinion from you guys.
Last edited by Swift&Smart; 04-15-2003 at 08:39 AM.
I knowthat this is of no real help now (as you have already forked out the cash), but O'Reilly books seem to be the better ones ATM. Oh, and Linux Format magazine regularly review books like this and problems like the ones you've had are often flagged up.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.