|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
You eat, breathe and sleep innovation. Build your mobile intelligence with BlackBerry® experts this July. Register Today! |
|
#1
|
|||
|
|||
|
RE: Create dynamic sites with PHP and MySQL
Hey guys,
As you can see I'm new here, and very new to PHP and MySQL. In this tutorial it talks about new versions of php may have difficulty with the code provided. Specifically the instructions on pages 8-10 of the Create Dynamic sites with PHP and MySQL tutorial, in the Putting it all together section. How would I complete that sections with newer php (without register_globals) or is it even possible? Jake |
|
#2
|
|||
|
|||
|
RE: RE: Create dynamic sites with PHP and MySQL
what register globals does is turns all the variables from user input like $_POST and $_GET into standard variables. for example on page 10, putting it all together, in the code they use if($submit){//whatever}. the proper way to call that is really if($_POST['submit']){//whatever}. if you use the $_POST part, then there is no problem.
|
|
#3
|
|||
|
|||
|
RE: RE: Create dynamic sites with PHP and MySQL
Thanks, that worked. I appreciate it.
|
|
#4
|
|||||
|
|||||
|
RE: RE: Create dynamic sites with PHP and MySQL
I ran into another problem in the same tutorial which I am unable to troubleshoot. Under the section, Editing data, I am running into trouble with the variable $PHP_SELF.
I using PHP 5.2, and Apache 2.2.3. Here's the code (some changes that I made, due to the newer version of php. Some of them are guesses): php Code:
This is following the tutorial referenced in the title of this thread. |
|
#5
|
|||
|
|||
|
RE: RE: Create dynamic sites with PHP and MySQL
|
|
#6
|
|||||
|
|||||
|
RE: RE: Create dynamic sites with PHP and MySQL
Thanks for pointing out those missing single quotes, and I don't understand why I need the $_SERVER['PHP_SELF'] could you elaborate on that?
I made those changes, but I get the following error: php Code:
What does T_ENCAPSED_AND_WHITESPACE mean? |
|
#7
|
|||
|
|||
|
RE: RE: Create dynamic sites with PHP and MySQL
the variable is really $_SERVER['PHP_SELF']. the $PHP_SELF variable is the result of having register globals on, everything in the $_SERVER array is made into its own variable just like with $_POST, $_GET, $_REQUEST, $_COOKIE, $_SESSION, $_ENV, $_SERVER...those are all super-global arrays which means they are created by php and can be used anywhere without having to declare them as global. turning on register globals makes anything in those arrays be extract() from the array and turned into non array variables.
|
|
#8
|
|||
|
|||
|
RE: RE: Create dynamic sites with PHP and MySQL
Thanks for the explanation it makes sense now. Any idea why this wouldn't work?
|
|
#9
|
|||
|
|||
|
RE: RE: Create dynamic sites with PHP and MySQL
I believe line 41 is this: <form method="get" action="<?php echo "$PHP_SELF"?>">
Could you post what you changed this to? |
|
#10
|
|||
|
|||
|
RE: RE: Create dynamic sites with PHP and MySQL
|
|
#11
|
|||
|
|||
|
RE: RE: Create dynamic sites with PHP and MySQL
To get the most help from PHP to find minor syntax errors, put the following line in after your first opening <?php tag -
error_reporting(E_ALL); This will cause a number of Notice messages to be output. You should fix as many of these as possible in the name of syntacticly correct code. Each of these Notices are logged to the server log file and cause a minor speed penalty. |
|
#12
|