Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I'll see if I can break it down for you.</p> <p>The initial if check to see if the function has not been defined (http://php.net/manual/en/function.function-exists.php). It then goes through and defines the function GetSQLValueString.</p> <p>Function GetSQLValueString does the following:</p> <ul> <li>It performs a ternary if check with the get_magic_quotes_gpc(Gets the current configuration setting of magic_quotes_gpc). If it passes, it stripeslahes $theValue, else it just returned the $theValue. </li> <li>Another ternary if check if perform to see if "mysql_real_escape_string" exists before either perform mysql_real_escape_string or mysql_escape_string.</li> <li>It picks the case that matches $theType variable and sets $theValue with appropriate values. </li> <li>Finally, it returns the Value so it can be used for whatever purpose it will serve in the code. </li> </ul> <p>The rest of the code is pretty simple db insert snippet.</p> <p>$editFormAction is set from whatever script is being run by php such as insert.php. An if check to confirm that there is a query string. If there is a query string, it appends to the end of the $editForm Action. Using the above PHP_SELF, this might be insert.php?name=Tim&amp;email=hello@world.com&amp;phone=8675309.</p> <p>The next part is where the magic of inserting information into the database. </p> <p>An if checks to see if MM_insert was set and it's value was form before continuing with the database insert. It's essentially a sanity check. After that point, it gives the variable $insertSQL with values from a formated string with the information passed from the form. You'll see it uses the function GetSQLValueString from earlier to make sure the data is prepared to go into the database. Once the $insertSQL has all it's values, it selects the DB then performs the query. </p> <p>After that, the success.php is set for $insertGoTo. The if check to see if the QUERY_STRING was passed to this page. If there was a QUERY_STRING, it appends it onto success.php (success.php?name=Tim&amp;email=hello@world.com&amp;phone=8675309). After the if check, it redirects the page by calling header. </p> <p>I hope that information helps you understand the breakdown of the script. </p> <p>----- Personal Note Here -----</p> <p>Dreamweaver is not a great application for developing PHP code. If you want a great IDE to use for PHP, I recommend PHPStorm(http://www.jetbrains.com/phpstorm/). I've been using it for over two years now and love it. I couple it with a great text editor, SublimeText2 (http://www.sublimetext.com/2).</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload