Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p><strong>Do not use <code>SHA()</code> to hash your passwords</strong></p> <p><a href="http://dev.mysql.com/doc//refman/5.5/en/encryption-functions.html#function_sha1" rel="nofollow">From the MySQL reference manual:</a></p> <blockquote> <p>Exploits for the MD5 and SHA-1 algorithms have become known. You may wish to consider using one of the other encryption functions described in this section instead, such as SHA2().</p> </blockquote> <p><strong>The mysql_* suite of functions should not continue to be used</strong></p> <blockquote> <p>"This extension is not recommended for writing new code. Instead, either the mysqli or PDO_MySQL extension should be used." -<a href="http://www.php.net/manual/en/intro.mysql.php" rel="nofollow">PHP.net</a></p> </blockquote> <p><strong>Now, regarding your questions</strong></p> <blockquote> <p>is this an efficient way to setup my database? &amp;&amp; Is it correct?</p> </blockquote> <p>It depends. Do you intend to only have one phone number per user, and one address per user? By specifying an address_ID field on the members table, you effectively limit the amount of addresses that member can be limited to to one. Alternatively, if you want to allow a user to have any number of addresses or phone numbers, the phone and address tables should have references to the member--not the other way around.</p> <p>If you really <em>do</em> only want one address and phone number per member, you should include all of that information on the members table. This will prevent unnecessary joins, and you can always specify what you want to <code>SELECT</code>.</p> <p>If you want multiple addresses and phone numbers, you still might want <a href="http://www.codinghorror.com/blog/2008/07/maybe-normalizing-isnt-normal.html" rel="nofollow">to denormalize</a> and just use a single table for all of that data. You would just have to limit the user to some reasonable number of addresses or phone numbers.</p> <blockquote> <p>How do i ensure that the address inputted in the form is assigned to DB address and the correct address_ID is recorded in DB Members? &amp;&amp; same for phone_ID in DB Phone AND DB members?</p> </blockquote> <p>If you use mysqli, use the <a href="http://php.net/manual/en/mysqli.insert-id.php" rel="nofollow"><code>insert_id</code> property</a>. If you use PDO, use the <a href="http://php.net/manual/en/pdo.lastinsertid.php" rel="nofollow">lastInsertId() method</a>.</p>
 

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