Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Apr 2014
    Posts
    8
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Getting information from database

    After using W3schools tutorial for everything I ended up finding out that their mysql tut is outdated. I haven't been able to find an up to date mysqli tutorial other then the php one but it is too hard to understand.


    All I'm trying to do is get all the usernames from the database and compare them to the username from the form input.

  • #2
    Regular Coder Linux_Sage's Avatar
    Join Date
    Mar 2014
    Location
    Sterling,VA
    Posts
    105
    Thanks
    0
    Thanked 10 Times in 10 Posts
    This one should be easy to follow: 'MySQLi' for Beginners - Codular

  • Users who have thanked Linux_Sage for this post:

    TrafalgarLaw (04-23-2014)

  • #3
    New to the CF scene
    Join Date
    Apr 2014
    Posts
    8
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Linux_Sage View Post
    This one should be easy to follow: 'MySQLi' for Beginners - Codular
    Thanks a lot Going to study for a bit and if any issues comes up I'll be sure to ask ^_^

  • #4
    New to the CF scene
    Join Date
    Apr 2014
    Posts
    8
    Thanks
    1
    Thanked 0 Times in 0 Posts
    I had the code working yesterday but I obviously changed something and now I can't figure out what I changed >.<
    Getting information from database-sql.png

  • #5
    New to the CF scene
    Join Date
    Apr 2014
    Posts
    8
    Thanks
    1
    Thanked 0 Times in 0 Posts
    I believe I have figured it out, but I want to check to make sure this is the correct way to do it:

    Getting information from database-sql.png

    P.S: Sorry about the double posting. Can't edit my posts :/

  • #6
    Regular Coder Linux_Sage's Avatar
    Join Date
    Mar 2014
    Location
    Sterling,VA
    Posts
    105
    Thanks
    0
    Thanked 10 Times in 10 Posts
    Looks like you swithced to a more procedural method. To get your first approach to work you might want to look back to that tutorial as to how they're accessing the results of the query. Because I've also noticed you're not assigning the results of $result->fetch_assoc to anything. Heare are some examples:

    PHP: mysqli_result::fetch_assoc - Manual


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •