Menu
Forums
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Trending
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
Upgrades
Log in
Register
What's new
Search
Search
Search titles only
By:
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Software Development
Programming
Programming Q&A
Connecting DB and Website..
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="JayC" data-source="post: 376991" data-attributes="member: 36373"><p>All you have to do is create a database connect and run your queries out of it.</p><p></p><p>[PHP]</p><p>$server = "localhost";</p><p>$username = "username";</p><p>$password = "password";</p><p></p><p>$connection = new mysqli($server, $username, $password);</p><p></p><p>if($connection->connect_error){</p><p> die("Connection failed: " . $conn->connect_error);</p><p>}</p><p>[/PHP]</p><p></p><p>Then:</p><p>[PHP]</p><p>$query = "SELECT * FROM USERS WHERE `username` = '".$_POST['username']."' AND `password` = '".MD5($_POST['password'])."' LIMIT 1";</p><p>$results = mysqli->query($query);</p><p>if(mysqli_num_rows($results) > 0){</p><p>//Login</p><p>$_SESSION['user'] = $_POST['username'];</p><p>}</p><p>[/PHP]</p><p></p><p>Pretty much just going to do this.. and same with register... This was off the top of my head so <img src="/styles/default/xenforo/smilies/emojione/smile.png" class="smilie" loading="lazy" alt=":)" title="Smile :)" data-shortname=":)" /> Don't copy and paste cause no promises.</p></blockquote><p></p>
[QUOTE="JayC, post: 376991, member: 36373"] All you have to do is create a database connect and run your queries out of it. [PHP] $server = "localhost"; $username = "username"; $password = "password"; $connection = new mysqli($server, $username, $password); if($connection->connect_error){ die("Connection failed: " . $conn->connect_error); } [/PHP] Then: [PHP] $query = "SELECT * FROM USERS WHERE `username` = '".$_POST['username']."' AND `password` = '".MD5($_POST['password'])."' LIMIT 1"; $results = mysqli->query($query); if(mysqli_num_rows($results) > 0){ //Login $_SESSION['user'] = $_POST['username']; } [/PHP] Pretty much just going to do this.. and same with register... This was off the top of my head so :) Don't copy and paste cause no promises. [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Software Development
Programming
Programming Q&A
Connecting DB and Website..
Top