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.

learn more… | top users | synonyms

3
votes
0answers
37 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 ...
1
vote
1answer
45 views

Restful resource with pagination and additional mapping

I have this script that i use to get all clients with their events, main thing here is that i need to return all clients that have some events in specific periods and also i need to show clients that ...
2
votes
1answer
64 views

PHP login page using prepared statements [closed]

I am new to the concept of prepared statement and i am trying to adjust my "user login" function to be a prepared statement. The part i am really struggling with is the fact i have multiple SQL ...
0
votes
2answers
26 views

Paginated method to get all items

I'm using slim php and i have this simple paginated end point to get all clients, i feel like i could do some things here better, so i would appreciate all suggestions, if possible please give me code ...
5
votes
1answer
53 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? ...
4
votes
2answers
92 views

Implementation of a Custom Database Class

Following Database Class is what I'm using as a wrapper to connect with MySqli in a application, and below the class is how i'm implementing it currently I'm not sure if this is the right way to ...
4
votes
2answers
95 views

Loading objects for users, roles, and groups from a query with LEFT OUTER JOINs

I have this function that returns me a list of users with their roles and groups. As you can see, this is how I fetch and create list of objects. I'm wondering whether this is a good approach and what ...
1
vote
1answer
73 views

PHP MySQLI Wrapper - SqlObject

This is a PHP script I wrote it back in 2015 and have been updating it since. It is a MySQLI wrapper called SqlObject (class) that was originally created to be ...
1
vote
1answer
65 views

PHP handle array when query database with one-to-many relationship

Well, I am writing a web service using PHP to return data from a DB in JSON format. I need to query 3 tables, which have a one-to-many relationship, like shown below: ...
1
vote
1answer
51 views

PHP & Mysqli Code - Is this code safe for a simple search?

I am writing some code to search my database and show results. Is the below code ok and safe enough? new to PHP and Mysqli so really appreciate any help that I can get on this subject. Thanks ...
3
votes
1answer
46 views

Fetching a post from the database based on a query parameter

I get an id via Get request to fetch an object from the database. I have used mysqli prepared statements to avoid any security problems. As I am new to these stuff I would like a confirmation that ...
1
vote
1answer
140 views

Secure database connection in PHP

I have this code i use to connect to the database and get thing from it secure, How can I make more secure?? ...
0
votes
2answers
64 views
2
votes
2answers
69 views

Register page for website

I've been working on a simple forum website as a toy project, to start learning PHP and SQL. I've implemented all of the functionality I want, but I thought I'd run the code by the Code Review ...
1
vote
0answers
91 views

Email thousands of customers from a PHP form using a MySQLi query on a MySQL database

How can a large internet service provider email certain customers to warn them about an impending service interruption? I'm providing what I think is a reasonable solution, but I have not tested it. ...
4
votes
2answers
151 views

PHP OOP Login Script

I'm new to both PHP and OOP and would like some constructive feedback on a class I made. I have a "main account" login system already setup and working; when the user logs in they're presented with a ...
0
votes
1answer
71 views

Select random IDs from a table, using MySQLi

I've created a "simple" function that receives a MySQLi resource and, using a custom where query, will fetch random IDs from a provided table. Some caveats on this:...
2
votes
3answers
260 views

Booking appointments with MySQLi and PHP

The following code books one appointment for one or more slots. I have never used database before, but have seen so many warnings regarding SQL injections. Since it has never affected me I have not ...
3
votes
4answers
534 views

User registration and authentication in PHP and PDO

Please criticize as thoroughly as possible, even the smallest thing will be very useful for me. I'm trying to create a safe and easy system to change for future projects. I am aware that it should ...
1
vote
3answers
234 views

Using object oriented PHP to display users in a database

I'm new to object oriented PHP, so I'm sure of the good or bad practices. The below code is working perfectly, I just don't know if it is a bad or good approach to use most of the methods as static ...
1
vote
1answer
58 views

DataBaseaction function connect insert update MySQL tables

This class will take just the table name and data array and will do the rest, update or insert. I know it's not perfect, but I could use some feedback. ...
1
vote
1answer
91 views

Class for database connections in PHP

I have made this class for database connections to my applications. It eases out the task of making connections to the database with knowing the credentials in advance and provides a way to execute ...
2
votes
1answer
167 views

Function for inserting data into database

I have this function to ease out the task of inserting data into databases. I am not very sure if it is secure to use it this way. Any suggestions on improving it? ...
0
votes
2answers
56 views

Database in Class for Reusability

Does this code fine for database reusability? ...
1
vote
1answer
32 views

Getting the last post of all threads

My MySQL query is loading very slowly (over 30 secs) and I was wandering what tweaks I can make to optimize it. The query should return the last post with the string "?" of all threads. ...
1
vote
3answers
74 views

Three PHP database queries to manage accounts

I have a database connection PHP file which has a lot of queries to the database. Here are 3 of the functions that I am using: ...
0
votes
1answer
50 views

Function that calls the database connection and query

I made a function that contains the database connection and query. Now I'm always calling this function every time I need to query a database. Is it good or is there another way better? Database ...
1
vote
1answer
82 views

Moving To Object Orientated Programming

Please keep in mind I am new and still learning when reading the following. What I am doing I have the following code which pulls a sport, tournament and round NR, from a DB table called ...
2
votes
4answers
177 views

PHP mysqli code for login form

Can you check my code if I wrote like a professional? connection page. form sign page. plan page. log out page. First I create the database and tables, then the connection file, then the form sign ...
1
vote
3answers
52 views

Building session array from post to build search query

So I am making post requests to a page for search queries. I am turning them into a session array so I can paginate the results. The process kind of feels ugly and long winded. I need code review for ...
3
votes
2answers
163 views

Checking the status of a website by hitting a PHP script

I currently have a system which loops through a bunch of my website domains and checks their status and sends me a notification letting me know if they are up or down. The stripped down version of the ...
2
votes
1answer
52 views

Queries for the number of users seen each day

The below code returns an array filled with the number of users last seen for each day for $dayCount number of days that is specified via a parameter into the ...
5
votes
2answers
321 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: ...
0
votes
3answers
290 views

Getting and posting data use PHP OOP and MySQLi

I am not very experienced in PHP OOP. Moreover, when MySQLi comes with PHP OOP, it makes me more confused about using it in the most efficient way. Connection class: ...
3
votes
1answer
51 views

Get title from database based on member country

I asked this question before. However, I realized that I had to edit some of my code after I got good answers. Therefore, I'm asking a new question here. I have the following database: Each member ...
0
votes
1answer
73 views

Load title from database based on member country

As tim suggested, some changes to the database was necessary. I have posed an improved version of this question at Get title from database based on member country. I have the following database: ...
2
votes
2answers
65 views

Insert into two tables during user registration using PHP

I'm working on creating a user registration script in PHP. I have two tables that need to be inserted into. One that stores some general user information, and another that stores their login ...
0
votes
1answer
79 views

PHP pages that interact with MySQL

Could someone review this PHP code to see if my pages are coded safely to not allow common attacks (SQL injection, XSS, etc.)? I would be thankful, of course, for anyone to point out other problems in ...
0
votes
0answers
43 views

Simple data-fetching and conversion into JSON using two different patterns

I'm trying to fetch and convert data into JSON format. Some days ago I was using MySQLi but someone told me this is susceptible to SQL injections when I asked a question for code review. Now I'm ...
5
votes
2answers
183 views

Adding an item to database + JSON

Is this code good? Or is it the noobiest PHP you've ever seen? ...
2
votes
1answer
337 views

PHP/MySQLi code for registration/login form

The following code works, I just want to know if there are any suggestions as to how I can make it better or more secure. Thanks. config.php: ...
3
votes
1answer
118 views

Checkout process

I'm building a checkout process where I am quite frequently making SQL connections based on user input so this is quite important. I want to know if it's well-protected from any SQL injection or other ...
1
vote
0answers
176 views

PHP rating function for getting the average value of column

I created a function to add and return the average rating. Rating Function ...
2
votes
1answer
142 views

Preventing SQL injection without using prepared statements

I'm learning OOP and totally new to this way of coding. I've always scripted PHP the procedurial way. Now I've written a working class, which creates a database connection and has the method to create ...
3
votes
1answer
171 views

Prepared PHP statement to fetch posts for some category

I am slowly learning PHP and have been using prepared statements. I have a simple category.php page, which takes a category tag to display posts from that category, such as localhost/php/category.php?...
-2
votes
1answer
111 views

Database and user classes for my personal CMS

I have written my own CMS for learning, and have included all of my core files below. This is my first time playing with OOP and prepared statements, so I imagine there may be alot of changing. There ...
2
votes
2answers
156 views

PHP crawler to collect comments on articles

I have code that parses through web pages finds commentaries and saves commentary info in DB. I have an array where all necessary pages are stored. I iterate through all these pages one by one and ...
9
votes
3answers
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 ...
-2
votes
1answer
73 views

Adding tables and values to a database

I am having problems with my code because I am using a system called styleci. Can you please check it? How can I make it better and more secure? ...
3
votes
2answers
122 views

First user login function: Security and efficency opinions

I am writing an application for work. This application will sit on a closed network but I still have to be concerned about security. There will be a maximum of three types of user for this application:...