Jump to content

Search the Community

Showing results for tags 'database'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Community
    • Community News
  • Web Game Design and Development
    • News & Updates
    • General Game Development
    • Creative Discussions
    • Coding and Programming
    • Tutorials and Guides
  • Marketplace
    • Looking To Hire
    • Looking For Work / Commissions
    • Marketplace Reviews
  • General Discussions
    • Off Topic
    • Community Feedback / Help
    • Jokes and Fun
    • Entertainment Talk
  • Novilar's
  • Eliyo's
  • Animal Acres's
  • Neopets's
  • IcePets's
  • MisticPets's
  • PokemonPets's
  • Flight Rising's
  • Lioden's
  • Tattered Weave's
  • Furvilla's
  • Eqcetera's
  • Equiverse's

Product Groups

  • Adoptables
    • Eggs
    • Backdrops
    • Additional Customizations
  • Advertising

Adoptable Stages

  • Corgicock
    • Egg
    • Chicgi
    • Corgicock
  • Lizardly Dragon
    • Egg
    • Kimono Lizard
    • Spiketail Dragon
  • Spiky Cat
    • Egg
    • Kittykin
    • Pinat
  • Dwarf Unicorn
    • Egg
    • Filli
    • Unicorn
  • Melon Kangaket
    • Egg
    • Kangakit
    • Kangakoo
    • Kangaket
  • Fuzzy Yeti
    • Egg
    • Yetiling
    • Fuzzy Yeti
  • Pure White Mottled Hare
    • Egg
    • Pure Mottled Kit
    • White Mottled Hare
  • Mottled Hare
    • Egg
    • Mottled Kit
    • Mottled Hare
  • Fawsh
    • Egg
    • Fawsh Younghoof
    • Fawsh Wavestrider
  • Oasis Naga
    • Egg
    • Oasis Nagaling
    • Oasis Naga
  • Kitsu
    • Egg
    • Kitsee
    • Kitsu
  • Vine Sloth
    • Seed
    • Vineling
    • Vine Sloth
  • Worm Cat
    • Egg
    • Wormling
    • Worm Cat
  • Demikin
    • Egg
    • Demonite
    • Demikin
  • Wolbit
    • Egg
    • Wollitte
    • Wolbit

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


About Me


Website


Xbox Gamertag


PlayStation Network


Nintendo ID

Found 3 results

  1. A recent data breach has been exposed which is being labeled as "Collection #1" and holds 772,904,991 unique emails with 21,222,975 unique passwords. I was browsing the possible sites that had been leaked within this collection and near the lower portion of the list was Verpets. I highly recommend anyone that has an account on Verpets on or prior to March 25th, 2018 to change their email, password, and any password/email combo related to your Verpets login information right away. If you would like to see if your information was compromised elsewhere; https://haveibeenpwned.com For more information on this breach and how attackers can utilize your information as well as tips on how to protect your information: The 773 Million Record "Collection #1" Data Breach Edit: Martyn advised me to post this here.
  2. Chris Fideloper released the first section of his new webcast series, Performant Laravel, this morning. Included was a really good introduction to indexing your database tables. If you're unfamiliar with this topic, I highly recommend giving these three videos a run through: https://serversforhackers.com/laravel-perf/mysql-indexing-one https://serversforhackers.com/laravel-perf/mysql-indexing-two https://serversforhackers.com/laravel-perf/mysql-indexing-three While it is a series about Laravel, these concepts are useful even if you're using another framework, or no framework at all. He is demonstrating on MySQL, but indexes work the same in Postgres, MariaDB, MS SQL Server, etc.
  3. Introductions Most of the sites you visit these days have some sort of database storage behind them. Most sites that use PHP will opt to use a MySQL database. You are able to interact with your MySQL database using the MySQLi class. MySQLi will only work with a MySQL database, whereas if you were to use PDO, it will work with various different database systems. MySQLi can be coded via objected oriented or procedural. Today I am going to be looking at the object orientated approach. PHP MySQLi Class Connecting Connecting to a MySQL database is done by instantiating a new instance of the MySQLi class. $db = new mysqli('localhost', 'username', 'password', 'paulsonny-demo'); if($db->connect_errno > 0){ die('Unable to connect to database [' . $db->connect_error . ']'); } The database name parameter is optional and can be left out. Please note, if you do leave the database name parameter empty then you will need to prefix all of your tables in your queries with the database name. Querying Let's assume we have a users table in our database and we wish to retrieve them all. $sql = "SELECT * FROM `users`"; if(!$result = $db->query($sql)){ die('There was an error running the query [' . $db->error . ']'); } The above will give you a $result variable that contains a mysqli_result object. Once we have the mysqli_result object we are able to loop through the results, perhaps displaying them to the user and then freeing up the result. Query Results If you wanted to loop through the results and show them to the user with each row being on a new line we'd do something like the following: while($row = $result->fetch_assoc()){ echo $row['username'] . '<br />'; } # of Returned Rows Each mysqli_result object that is returned from the database as a variable which is called num_rows. This can be accessed by doing the following: <?php echo 'Total results: ' . $result->num_rows; ?> # of Affected Rows When you are running an UPDATE statement, you may sometimes wish to know how many rows have been updated. The mysqli object has a variable called a affected_rows which can be accessed as follows: <?php echo 'Total rows updated: ' . $db->affected_rows; ?> Free the Result Once you have finished with your result set, it is recommend that you free the result. This would be placed after our looping over the records. $result->free(); This will free up some system resources, and is a good practice to get in the habit of doing. Escaping characters When inserting data into a database, it is recommended to escape it first, so that single quotes get preceded be a backslash. This will mean that any quotes won't break out of any that you use in your SQL. You should look to use the below method: $db->real_escape_string('This is an unescaped "string"'); However, because this is a commonly used function, there is an alias function that you can use which is shorter and less to type: $db->escape_string('This is an unescape "string"'); This string would now be safer to insert into your database through a query. Close Database Connection Don't forget, when you've finished with your database to make sure that you close the connection: $db->close(); PHP MySQL Class If you are using the functions mysql_connect() or mysql_query() then I would recommend swapping to the above. Any functions prefixed with mysql_ are actively discouraged by PHP themselves. In my next MySQLi Tutorial I will cover Prepared Statements. This tutorial and more like it can be found on my company website: P S Web Solutions Ltd.
×
×
  • Create New...

Important Information

By using this site, you agree to our Guidelines, Terms of Use, and Privacy Policy.