Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
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.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
(yeah i know it is stupid, it is just and example). i've saved it under /usr/local/apache/htdocs/test.php. now i entered it with my browser (i use mozilla 1.5 [polish version]) and added ?a=1 in the url. well as most of you'd expect (well i did too), the browser shoul display 1, but instead it displayed 3! well i checked it on a few of my previous scripts, and unfortunately discovered that php server i'm running does retrieve information included in url (?name=val). how can i root out that problem? i guess i should set something in php.ini, but i haven't got the slightest idea what?
plz help me.
you are trying to compare them to a string value of "1" etc. in this use, "1" is not a number, and therefore can't be compared. to actually compare strings you need to use strcmp or a similar function. to stick with numeric equality, drop the quotes.
now the problem i mean is that i should see "bla bla bla" while i enter http://localhost/test.php?a=xxx and "something" when http://localhost/test.php?a=zzz.
but instead i see "whatever" in each case. that means php does not consider name=value in url as variable, as it should do. instead it treats as if $a variable was not set, and so it displays third condition. i had a similar problem on Windows when i installed apache, and than php. but on Windows i could install PHP Traid, with apache+php+mysql already working together. therefore i think that something should be set in /usr/local/lib/php.ini however i'm not sure. now i hope my thread i more clear ^^. sorry for confusion.
and it worked fine, but...
my other scripts aren't working fine, that is the worst thing. they worked fine, and i'm 100% sure of their comatibility. there must be something in php server settings. it is important for me, not to change my scripts source code since i've already tested them on my (purchased) server. with positive result. have you got any ideas what else could i do?
Originally posted by jogurt666
if($a == 'xxx')
echo 'bla bla bla';
if($a == 'zzz')
The problem is that this code runs the first conditional, and it is true ($a == 'xxx'), so it echo's 'bla bla bla'. Then it runs the second conditional, and it is false ($a != 'zzz'), so it executes the else, i.e. it echo's 'whatever'.
To do what (I think) you expect, you must change the second conditional to:
elseif ($a == 'zzz')