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

1
vote
2answers
42 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
35 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
64 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
65 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
48 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
68 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
50 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
212 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
2answers
71 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 make me more confused about using it in best efficient way. Anyway, first look at my connection class: ...
3
votes
1answer
47 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 ...
0
votes
1answer
64 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
44 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
75 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
37 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
113 views

Adding an item to database + JSON

Is this code good? Or is it the noobiest PHP you've ever seen? ...
2
votes
0answers
60 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
65 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
101 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
126 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
73 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?...
-1
votes
1answer
58 views

I'm not sure if my query is safe or I need an extra step to sanitize data

I'm not sure if my query needs extra steps to sanitize data to prevent SQL injection. If I use $wpdb->get_results($query), do I need to ...
-2
votes
1answer
99 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
109 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 ...
8
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
63 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
97 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:...
6
votes
5answers
518 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, ...
2
votes
2answers
4k views

Inserting JSON array data into a MySQL database using PHP

Here I am parsing a JSON array and inserting it into a MySQL database. The JSON Array comes from my android code. This is how my JSON array looks like: ...
2
votes
1answer
68 views

Security of login form using prepared statements

I've prepared a simple login form, using prepared statements to prevent SQL injections. How secure is this ? ...
0
votes
2answers
81 views

Custom MySQLi connector class for PHP

I have written a class that connects to a database using MySQLi and has methods for the connection itself and returns the instance of the MySQLi class. This works, but feels a little "clunky" and ...
-2
votes
2answers
62 views

Authentication check in index.php file

I am aware that this code is vulnerable for SQL injections, but I don't know how to avoid it. ...
3
votes
1answer
142 views

Pulling data from API, Allowed memory exhausted

I'm working on a project where I pull data (JSON) from an API. I would like to manipulate this data and store this as useful information in my DB (MySQL). My code is working if I would like to make, ...
4
votes
1answer
242 views

Converting uploaded video and saving preview images

I'm coding a basic video upload system for a client. The uploaded videos will live on the page using the HTML5 video element. Essentially what I've done is call the following PHP script ...
0
votes
1answer
31 views

Applying prepare statements

I don't feel that my code is secure, and would like some help in using prepare statements for the following; ...
2
votes
3answers
152 views

Checkout (page) backend

I am developing an e-commerce site and am confused about this. Customers come on the site and add some products to the cart. Customers click on the checkout link if already logged in, then will go ...
2
votes
2answers
96 views

Registering usernames and passwords to a database

Here is my script that registers a user to a database. I am still very much a newbie when it comes to this topic so any guidance would be greatly appreciated. ...
1
vote
1answer
63 views

Handle data received by Ajax request and update database (prepared statement)

I have an Ajax request from a page where the user is being asked to enter their date of birth. The request URL file has the code below and works all good. However, I'll be rewriting all MySQL/MySQLi ...
6
votes
2answers
135 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 ...
0
votes
1answer
66 views

Website registration

Can you please tell me how to improve this code? ...
4
votes
1answer
155 views

Database connection wrapper class

I am trying to create a PHP / MySQLi wrapper class that uses prepared statements, the goal of the class is to create a connection to the Database, then INSERT / <...
2
votes
1answer
79 views

Secured Database Insert

I've been working on a safe inserting method for a while, and I think I've found a pretty secure way to do this. Would you CRitters mind taking a look at it and maybe give me some tips to improve my ...
5
votes
1answer
220 views

Website user password verification

I have a login web page where a user enters their email and password and I need to check if: the entered email exists in the DB and the entered password matches the hashed one from the db. The ...
8
votes
1answer
897 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 ...
4
votes
3answers
899 views

Preparing and executing MySQL SELECT query from parameters

I am trying to make a function for Select statements. It will give result based from the parameters passed. I tried using it and it gives the results I am expecting. I know that it is still ...
5
votes
1answer
168 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. ...
4
votes
2answers
1k 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 ...
2
votes
1answer
53 views

Placing navigation items into an array

I am looking for better ways to write this code. At the moment it grabs a list of all navigation items and places them into an array (using PDO). However, as you can see, it is using two ...
4
votes
2answers
477 views

Shopping cart login and coupon code validation

I am figuring out how I could make the following query more secure: I have already used mysqli_real_escape_string but I doubt that adds much to security. I have ...
3
votes
2answers
237 views

Single MySQLI query to check for admin privileges

I have this script on top of all pages to check if user is admin otherwise we kick him. The problem is that I don't know if I am using double resources with a double query and results. Can I make this ...
2
votes
3answers
2k views

A very secure procedural MySQLI login script against injections

I know there are other ways to create a login script like Object Oriented, Prepared Statements and PDO, but how about those old MySQL PHP users like me trying to change from old style to the new ways? ...