|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||||
|
|||||
|
PHP, MySQL & Apache
Hi, I've just installed Apache 2.0.48, PHP 4.3.4 and MySQL 3.23.49 on my Windows machine. I've got simple functions like phpinfo() and some code from a PHP & MySQL for Dummies book, and they both work fine - I'm getting information on PHP, and some tables from MySQL. However, a simple database interface included with the book, which has two fields, one for entering the database name, and the other for entering the query, just plain isn't working.
First up, the $PHP_SELF variable. I get the following error message: Notice: Undefined variable: PHP_SELF in D:serverdummiesmysql_send.php on line 76 ?form=yes method="post"> Okay, fair enough. I've replaced that with other variations of the same function, and the error message disappears. However, the problem of it not doing anything still stands. To make it work, I've been told by the book to simply enter 'show databases', to display a list of all the databases. No prizes for guessing what happens (or doesn't happen). Below is the entire code for the page, if anyone has any ideas on whats going on, please let me know so I can get back to work on my website (installing PHP and MySQL on my machine was only as a testing area - I'm on 56k, so uploading all the time is a bit of a bother). php Code:
Thanks. |
|
#2
|
|||
|
|||
|
RE: PHP, MySQL & Apache
I haven't gone through PHP & MySQL for Dummies book. It might be that it supports older version of PHP. (Not sure though) For the error that you are getting it might be that the register_globals setting is set to off in your php.ini file.
So instead of $PHP_SELF try using $_SERVER["PHP_SELF"] Instead of $database try using $_POST["database"] Instead of $query try using $_POST["query"] Thats what I spotted for the moment. Try that out and see. |
|
#3
|
||||
|
||||
|
RE: PHP, MySQL & Apache
dont forget your ;'s
|
|
#4
|
||||
|
||||
|
RE: PHP, MySQL & Apache
Because you have missed some out.
|
|
#5
|
|||
|
|||
|
RE: PHP, MySQL & Apache
If you would like to use $PHP_SELF as a variable as the book suggests, you need to edit your php.ini file to turn register_globals [b]on[b]. Theoretically, the book is right, but it assumes you have globals turned on.
|
|
#6
|
|||
|
|||
|
RE: RE: PHP, MySQL & Apache
Quote:
nawlej, you hero - works perfectly Thanks a lot guys! |
|
#7
|
|||
|
|||
|
RE: PHP, MySQL & Apache
Quote:
He is.. But other's aren't zero either. The book is right for the time when it was written. But you need to get used to new releases of PHP. So only a book won't do the job for you. You need to be in touch. www.php.net the home of PHP is always the first option. And Codewalkers.com community will keep you up-to-date. I recommend you to set the register_globals option to OFF. Even though you are a Newbie learn the better way. Have a look at this http://www.php.net/register_globals |
|
#8
|
||||
|
||||
|
RE: PHP, MySQL & Apache
Yeh You should write your scripts to cope with register_globals being turned off which is set as default on most servers. Even if you have register_globals on then there will come a day when you give the script to someone and it wont work because register_globals is off on their server and they cant turn it on because its a shared host. So its better to make your scripts work without register globals.
|
![]() |
| Viewing: Codewalkers Forums > PHP Related > PHP Installation > PHP, MySQL & Apache |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|