Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 791 Vote(s) - 3.51 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Can't Get Started? - PHP & MySQL

#1
What made me want to learn PHP was that the language (and others) enabled me to delete, insert, update etc fields within tables within my database using specific SQL queries.

This is small, but may be an effective information thread for your newbie self.

I'm going to start this topic off with some useful links:
  1. [To see links please register here]

  2. [To see links please register here]

Now, hence the order I have placed these links, you should check each website out in order.

Code Academy
You should most definitely complete the 10 or more lessons related to PHP provided. You will cover the basics of arrays, if then else statements, functions and quite a few other aspects.

PHP Academy
This website is more for you to use when you know the basics. Watch their videos, and follow their tutorials closely while observing what code does what. You should know the basics from what you've learned over at Code Academy. I suggest you start with the Login and Register tutorial first.

Basic PHP & SQL Example
Below is a very simple registration page which hopefully some of you may understand.

PHP Code:
<html>
    <
head>
        <
title>Add New Record in MySQL Database</title>
    </
head>

    <
body>
        <?
php
            $error 
= array();
            if (isset(
$_POST['submit'])) {
            
            if (empty(
$_POST['username']) || empty($_POST['password'])) {
                
$error[] = 'You must fill in both fields.';
                echo 
'<ul><li>' implode('</li><li>'$error) . '</li></ul>';
                die();
            }
            
            
$dbhost 'localhost';
            
$dbuser 'root';
            
$dbpass '';
            
            
$conn mysql_connect($dbhost$dbuser$dbpass);
            if (! 
$conn ) {
              die(
'Could not connect: ' mysql_error());
            }
            
            
$username $_POST['username'];
            
$password md5($_POST['password']);

            
$sql "INSERT INTO users (username, password) VALUES('$username','$password')";
            
mysql_select_db('profile');
            
            
$retval mysql_query($sql,$conn);
            if(! 
$retval ) {
              die(
'Could not enter data: ' mysql_error());
            }
            echo 
"Entered data successfully\n";
            
mysql_close($conn);
            }
            else {
            
?>
                <form method="post" action="<?php $_PHP_SELF ?>">
                <table width="600" border="0" cellspacing="1" cellpadding="2">
                <tr>
                <td width="250">Username</td>
                <td>
                <input name="username" type="text" id="username">
                </td>
                </tr>
                <tr>
                <td width="250">Password</td>
                <td>
                <input name="password" type="password" id="password">
                </td>
                </tr>
                <tr>
                <td width="250"> </td>
                <td> </td>
                </tr>
                <tr>
                <td width="250"> </td>
                <td>
                <input name="submit" type="submit" id="submit" value="Register">
                </td>
                </tr>
                </table>
                </form>
            <?php
            
}
            
?>
    </body>
</html> 

I'm hosting this website locally. My host is localhost, database name is profile, username is root and I have no password set.

Users simply input their desired username and password and the server will update your MySQL database like so.

There's no input validation really on this form except to see if either input box is empty, otherwise we'll show an error. I suggest you only use this for learning purposes.

Private message me if you would like the database file to go along with this. I'll also include a basic user profile.

I'm still learning so don't give me too much hassle for anything I've done wrong. I thought I'd share this with users as I struggled deeply to get started. :confused:mile:
Reply

#2
Quote:(07-17-2013, 02:28 PM)Sanctuary Wrote:

[To see links please register here]

I tried learning PHP & MySQL once. I got somewhat far and learned quite a few things, which made me understand the languages more, but the tutorials I was watching barely taught me on what to do with the language.

I later picked up jQuery (watched the PHP Academy videos) and I felt like that was a better language for me, thus realizing that I like to work on the front end of the site instead of the back end.

I like both front-end and back-end but I now mostly prefer back-end. I plan to get to grips with PHP and SQL before moving on to jQuery etc.
Reply

#3
I tried learning PHP & MySQL once. I got somewhat far and learned quite a few things, which made me understand the languages more, but the tutorials I was watching barely taught me on what to do with the language.

I later picked up jQuery (watched the PHP Academy videos) and I felt like that was a better language for me, thus realizing that I like to work on the front end of the site instead of the back end.
Reply

#4
I tried learning PHP & MySQL once. I got somewhat far and learned quite a few things, which made me understand the languages more, but the tutorials I was watching barely taught me on what to do with the language.

I later picked up jQuery (watched the PHP Academy videos) and I felt like that was a better language for me, thus realizing that I like to work on the front end of the site instead of the back end.
Reply

#5
Quote:(07-17-2013, 02:28 PM)Sanctuary Wrote:

[To see links please register here]

I tried learning PHP & MySQL once. I got somewhat far and learned quite a few things, which made me understand the languages more, but the tutorials I was watching barely taught me on what to do with the language.

I later picked up jQuery (watched the PHP Academy videos) and I felt like that was a better language for me, thus realizing that I like to work on the front end of the site instead of the back end.

I like both front-end and back-end but I now mostly prefer back-end. I plan to get to grips with PHP and SQL before moving on to jQuery etc.
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through