setting up PHP & MySQL
I've tried setting up PHP & MySQL for days now.. i can't seem to do it? i've been following manuals and books exactly..
and shouldn't these come in the distribution anyways? i'm using RH 8.0 i selelcted it.. but it didn't work!! need some guidance here. |
Mmmmmmm.. So what is the problem? What are the errors? Give us a little more information about the situation. Thanks.
|
I prefer not to use RPMs for these two apps, partly because I needed to customize PHP further but also because I was able to follow the instructions supplied in PHP's and MySQL's documentation.
I'd suggest removing the PHP and MySQL rpms and grabbing a MySQL binary from mysql.com and the PHP source from php.net. |
yeah that worked!
i removed them and re installed them again.. i don't know why the versions that came with the CD didn't work though.. Hmm.. anyways it works.. but another problem with php.. it doesn't seem to be able to pass values from one page to another.. ok, i start with a HTML page with a form, then submit the info to the .php file.. the .php can't seem to read the variables? here is the .html code --form.html <HTML> <head> <title>form.html</title> <META NAME="Generator" CONTENT="EditPlus"> </head> <body> <form action = "form.php" method = "get"> <table align = "center" border = 1 > <tr> <TD><font size=5><b>name</b></font></TD> <TD><input type="text" name="name" size ="20"></TD> </tr> <tr> <TD><font size=5><b>phone number</b></font></TD> <TD><input type="text" name="phone" size="20"></TD> </tr> <tr> <TD width="134" height="38" align="center"> <input type="submit" value="Yes" name="Yes"></TD> <TD width="190" height="38" align="center"> <input type="Reset" value="Reset" name="reset"></TD> </tr> </table> </form> </body> </HTML> here is the .php code --form.php <?php echo"<table align=center>"; echo"<TR><TD><font size=5>name</font></TD>"; echo"<TD><font size=5>$name</font></TD>"; echo"<TR><TD><font size=5>phone number</font></TD>"; echo"<TD><font size=5>$phone</font></TD>"; echo"</table>"; ?> |
Either edit your php.ini file and set register_globals to ON or better still use $_GET['variable_name']
Regards BB |
nope.. still doesn't work..
|
Butterbur's advice is correct. You need to do what he's suggested. Make sure you restart apache after making these changes (and make sure you've edited the correct php.ini file :) Could there be one lying around from the previous installation?)
|
ahh sorry i worked after all!
it wasn't the global variables actaully.. i just used the$GET_[variable] :D very nice.. i spent all day trying to figure this silly thing out.. |
actaully, why does this occur?
in the text book, they didn't use the $GET_['variable'] ??? what's the difference? |
It's a security issue. You can find details here
|
It IS about enabling the register globals option. $_GET["varname"] (or $_POST["varname"]) is always available, but when register globals is on, then PHP will automagically make $varname available (or 'register' them) in your script as a global variable.
The reason why the book doesn't use them is because the $_GET and $_POST arrays didn't come in until recent version of PHP. It used to be the case that the register globals options was set to 'on' by default. Nowdays it's set to off and the PHP people encourage developers to use the $_GET style method because it's more secure. |
Ahah!
yeah, my book is a bit old.. i just got a new one, and it said what you said, pretty much.. ! thanks again! |
No probs! Enjoy the language, it's a fun one.
|
All times are GMT -5. The time now is 07:06 AM. |