Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>How are you checking that the data fields aren't blank before inserting them into the db. Make sure to use empty() to check that the field is blank. If you're using string comparison operator (ie. if ($str != "") ), it can cause unexpected results if the value of $str is false, null, 0, etc...</p> <p>Edit: <strong>empty() description from manual: <a href="http://us.php.net/manual/en/function.empty.php" rel="nofollow noreferrer">http://us.php.net/manual/en/function.empty.php</a></strong> Return Values</p> <p>Returns FALSE if var has a non-empty and non-zero value.</p> <p>The following things are considered to be empty:</p> <pre><code>* "" (an empty string) * 0 (0 as an integer) * "0" (0 as a string) * NULL * FALSE * array() (an empty array) * var $var; (a variable declared, but without a value in a class) </code></pre> <p>edit2:</p> <p>isset() only checks if a variable was assigned a value. If the variable contains an empty string, isset() will return true, because even an empty string has a value ('\0' marks the end of a string in php).</p> <p><strong>isset() description from manual : <a href="http://us3.php.net/manual/en/function.isset.php" rel="nofollow noreferrer">http://us3.php.net/manual/en/function.isset.php</a></strong> </p> <p>isset() will return FALSE if testing a variable that has been set to NULL. Also note that a NULL byte ("\0") is not equivalent to the PHP NULL constant. </p> <p><strong>comment from manual :</strong></p> <p>isset doesn't reliably evaluate variables with blank strings (not necessarily NULL). i.e. $blankvar = ""; // isset will return true on this.</p> <p>This is a very common pitfall when handling HTML forms that return blank text fields to the script. You're better off doing this:</p> <p>if ($var != "") return true; else return false;</p> <p>This more of a programming practice rather than the function's shortcomings. So if you have a habit of initializing variables you're likely to run into problems with isset() if your code or php project become very large.</p>
    singulars
    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.
    2. 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