Questions tagged [mysqli]

The MySQLi extension, or as it is sometimes known, the MySQL Improved extension, was developed to take advantage of new features found in MySQL systems versions 4.1.3 and newer. The MySQLi extension is included with PHP versions 5 and later.

Filter by
Sorted by
Tagged with
19 votes
2 answers
621 views

A take on DB Abstraction

It's a little bit more code but I wanted to show the full class. I highlight the points I'd like input after the source. I've cut comments since they where not in English and translated the important ...
user avatar
  • 1,536
17 votes
3 answers
1k views

Prepared statements from security viewpoint

I've decided to go with OOP style and prepared statements, and so far I like it a lot more than the procedural style. It's much more understandable in my opinion. For this code review, I've just ...
user avatar
  • 898
11 votes
4 answers
21k views

PHP OOP Login Class

This is a login class I made for my personal website. What I don't care about, is how secure this login class is, because I know it's not. But it keeps out the rare unwanted guests because I do not ...
user avatar
  • 377
11 votes
3 answers
703 views

Secured registration script

I created code for my registration form on my social network. I want to know if it is secured enough to release on the web as a public social network. Also, all of the code works. I just want to make ...
user avatar
11 votes
2 answers
808 views

SQL injection safety check

I was wondering if my code is safe for sql injection. This code just checks if the username exists in my db or not. ...
user avatar
  • 315
10 votes
3 answers
1k views

Inserting OAuth data into a database

I am totally new to PHP. I just wrote a PHP script for google oauth to pull the data and insert into my database. I don't know if my code is vulnerable to SQL injection. Should I have used prepared ...
user avatar
10 votes
2 answers
360 views

Update of Classes for user registration and authentication

Old Post: Classes for user registration and authentication This post is an update of the old post of mine. This is the code after suggestions were implemented in the review. Do you think I could make ...
user avatar
10 votes
1 answer
4k views

SQL Tic-Tac-Toe attempt

In an attempt to practice conditional statements in SQL I decided to design a tic-tac-toe game with MySQL. Let me know if you think any of the steps could be done better. Step 1: Create the game ...
user avatar
  • 20.3k
9 votes
3 answers
35k views

First PHP login system

This is my first attempt at a login system! I've only had roughly 2 days of experience with MySQL and PHP so far and this is what I came up with: ...
user avatar
  • 565
8 votes
3 answers
4k views

A Simple, One-Page PHP Admin Login (with prepared SQL statements)

First off, I want mention that this code works well. This is more of a request for suggestions... We're attempting to program a one-page, recursive, token-based admin shell that is safe from ...
user avatar
  • 533
8 votes
2 answers
658 views

A PHP User System

This PHP User System was built with MySQLi and I also used Composer. I'm planning to improve this, and add more stuff and release it as a sort of a module for Composer. User.php (Controller File in ...
user avatar
8 votes
2 answers
6k views

Classes for user registration and authentication

...
user avatar
8 votes
3 answers
4k views

MySQL update with PHP; MySQLi prepared statement in loop

I'm going to develop an Android application that performs simple MySQL operations by invoking server-sided PHP scripts. PHP-MySQL communication is done by MySQLi extension. Each operation that I'd ...
user avatar
  • 322
8 votes
1 answer
258 views

Optimize web-scraping of Moscow grocery website

This code works fine, but I believe it has optimization problems. Please review this. Also, please keep in mind that it stops after each iteration of the loop ...
user avatar
  • 183
8 votes
1 answer
2k views

Basic registration page and database insertion

Please review my registration code and suggest what changes I should make to improve security. I'm new to PHP and this is my first project. Also I have no Idea how to make a "forget password page" as ...
user avatar
8 votes
1 answer
556 views

MySQLi_Recordset: blending SPL and Statement/Query results

I've made a SPL-based class named "Recordset" that wraps both MySQLi_STMT and MySQLi_Result objects and allows treating either as a 3-dimensional array. It requires PHP5.3+. I'm pretty bummed about ...
7 votes
2 answers
1k views

Preventing SQL injection by converting all characters to their ASCII values

In order to prevent SQL injection, I'm converting every character of a string to be inserted in the database into its ASCII value before performing the query. In order to read the value of the string ...
user avatar
  • 277
7 votes
2 answers
4k views

Database Handler Class

I've written this DB Handler class. Please review it and suggest any code edits or point out mistakes and security loop holes. Please also suggest a better way to handle things, if there is a security ...
user avatar
7 votes
2 answers
676 views

Modifying `sakila` database

This is not "real life" code. I'm trying to expand upon the well known Sakila sample database for MySQL to make it more complex. Step 7 (or 6) is running ...
user avatar
  • 20.3k
7 votes
1 answer
2k views

MySQLi DB library - quality/security review?

This libray was written quite some time ago, and it has so far been used in all sorts of small-ish projects. I'm about to base a more complex, security (Access Control) related, open-source project ...
7 votes
4 answers
6k views

Create a 2D array from SQL table

I am a beginner to PHP programming. I wanted to make a 2D array that would store the values of a table into the array. Below is the Frankenstein code I created (every time I wanted to achieve a task ...
user avatar
  • 241
7 votes
2 answers
647 views

PHP MySQLi Connection File

I have recently adjusted the way I create my mysqli connections. Initially I would include the connection file and use ...
user avatar
6 votes
5 answers
7k views

Function to get rows from database

I have a function that returns rows from my database, and it works fine, but I was told that it was poorly written, and there is a lot of unnecessary code in it. I'm wondering if there is a simpler, ...
user avatar
  • 163
6 votes
2 answers
214 views

How is my injection protection?

What do I need to do to prevent injections? In addition, if I have any statement/parameter errors, please tell me. ...
user avatar
6 votes
3 answers
190 views

php one-time prepared statement execution function

I use prepared statements often even when I only need to execute the statement once (for security), so I implemented a function to abstract away all the function calls on the mysqli_stmt object, as ...
user avatar
  • 1,102
6 votes
2 answers
2k views

Minimalistic mysql db class

I am really just looking to make sure I am not making any weird mistakes that could hurt me in the long run or if something seems odd in the way I imagine it to work. This code does work for the way I ...
user avatar
6 votes
2 answers
299 views

Password recovery program

This is a password recovery program I made, and I just want it checked out. These aren't all the files for the login and register system, only the password recovery part. The columns in the ...
user avatar
  • 195
6 votes
1 answer
930 views

PHP login script

I'm hoping someone would be able to identify if my code is prone to SQL injections, and just overall see if there is anything that could be done better. This is also my first time using MySQLi ...
user avatar
6 votes
2 answers
10k views

PHP registration/login form

I'm fairly new to MySQLi and PHP, but I've been working at it for a bit now, and reading up on how to make secure login forms, avoid SQL injection etc. I'm a mere amateur though. I've created an ...
user avatar
6 votes
1 answer
3k views

Doing a roll back with multiple MySQLI prepared statement

This is my code for doing a roll back with multiple MySQLI prepared statement. I want to know if anything is wrong with the code. ...
user avatar
6 votes
2 answers
1k views

Login with facebook, store data in MySQL, render profile and admin panel

I have an online catalog on which I need the customers to save their favorite products and shipping addresses. I want to manage the access with Facebook for security of all. I also need a section for ...
user avatar
  • 61
5 votes
4 answers
7k views

Two while for the same query

If I have to loop results of a query echoing first all fields of a column, then echoing something not to loop, then fields of another column. ...
user avatar
5 votes
2 answers
8k views

My database class extends MySQLi

The following is a small class I extended MySQLi with. I'm going to use this in my upcoming projects, but my main reason to do this class is learning, so I would like to submit this for your review, ...
user avatar
  • 383
5 votes
2 answers
228 views

Adding an item to database + JSON

Is this code good? Or is it the noobiest PHP you've ever seen? ...
user avatar
5 votes
4 answers
1k views

Programming MySQLi prepared statements

I'm programming code with MySQLi prepared statements. I'm a beginner and just want to ask to experts if my code is correct. ...
user avatar
  • 101
5 votes
2 answers
1k views

Custom MySQLI Class

I have created this MySQLI Class. I wanted to know if this class is secure enough to be used on the production websites or more improvements can be done to this class. ...
user avatar
  • 151
5 votes
2 answers
170 views

Average of averages

I need to get the average of multiple averages calculated basing on data contained on a sql database. To do that, I'm using this code: ...
user avatar
5 votes
2 answers
2k views

Inserting a record into MySQL with a timestamp

I'm starting with PHP so I can save data to a MySQL database. I read a lot and it seems the "escape" strings is not so safe. This is my code: ...
user avatar
  • 51
5 votes
3 answers
352 views

Functions in PHP to run basic MySQL crud

I wrote a list of functions in PHP that I want to use in my pet project as an autoloaded file for all parts of the app. The purpose of these function is to shorten the code you write for MySQL queries ...
user avatar
5 votes
2 answers
27k views

Simple PHP Login Register Script with OOP

I am relatively new to programming and OOP in PHP. I tried to create a Simple Login Register Script using my basic knowledge of OOP. I'm sure my code can be better in a lot of way. I'm trying to code ...
user avatar
  • 153
5 votes
2 answers
9k views

Dropdown form that shows data from 2 different tables

I am very new to this and am using php and MySQLi to create a form which will create a record in a third table. This works fine but I can't help but think that there is a way to do it with a single ...
user avatar
  • 53
5 votes
2 answers
102 views

PHP password-resetting page

I am producing a PHP code and I want to implement it in my server to do its function. My question is, are there any vulnerabilities that I should correct? I tried to establish the session first then ...
user avatar
5 votes
1 answer
186 views

PHP - First Login System

I am quite new to PHP, and with the help of a few tutorials have made this login system. However I know its not as efficient and compact as it could be, also I am looking for ways to improve the ...
user avatar
5 votes
1 answer
8k views

PHP MySQLi wrapper class

I've created a minimal PHP-MySQLi database wrapper class that can be used to run insert, select, update and delete queries via prepared methods with ease. Here's the wrapper class: ...
user avatar
  • 53
5 votes
2 answers
3k views

Secure INSERTs with MySQLi

Is this code well protected, and if not, could you tell me how it might be exploited and how to secure it? ...
user avatar
5 votes
1 answer
827 views

Arithmetic quiz using PHP5 and mySQLi

I would very much appreciate a general review of my PHP code which grabs information from a mySQL database and also inserts some information into the database. Overview : Users go to /main.php and ...
user avatar
  • 898
5 votes
2 answers
32k views

Handling data returned from fetch_assoc()

I connected to the db, pull the data using fetch_assoc() (fetch_all(NUMB) is not available on the machine we are working with ...
user avatar
5 votes
1 answer
305 views

Return a tuple from MySQL database with statements

I have a database from which I'd like to return a tuple of two elements (ID and URL) with check digit to see if operation was successful. Is correct this code to return this tuple and control? ...
user avatar
5 votes
2 answers
7k views

Update PHP function GetSQLValueString

The old function was: ...
user avatar
  • 219
5 votes
1 answer
696 views

MySQLi library for handling MySQLi interactions

I wrote this class recently to better structure and handle MySQLi related interactions with PHP and would love to get some feedback. ...
user avatar

1
2 3 4 5 6