Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

0
votes
1answer
25 views

Simple PHP project to store inputs in MySQL and output them

As my first simple PHP project, I've created a simple project that allows you to just enter your name and two numbers, where it displays them on the page and stores them in a database. It consists of ...
1
vote
3answers
117 views

PHP script security for new user registration

I would like to ask the experts here if this is secure. If it is not can I get an explanation as to why it would not be secure? I have been reading off and on on sites for this and I have trouble ...
0
votes
2answers
61 views

Use a comma-separated field in another SQL query

I was just wondering if there was a better way to write this block of code in php. I have a string with values separated by commas. I need to prepare that string to pass it on to the query using IN ...
2
votes
0answers
190 views

PHP login script using mysqli

Can you guys tell me if my login is secure? Login.php ...
2
votes
1answer
51 views

Showing all records on a webpage

I have a connection with my database to show all my records on a webpage, and I'm not sure if this code is safe: ...
1
vote
2answers
59 views

Merge both sql queries into one to get the performance

Currently i am using 2 queries - one for reattemptdate & one for holddate.... if we merge both queries & get the results in single query , than will it give better performance? if so how to ...
0
votes
2answers
66 views

Tracking employee data

We have hundreds of employees and for tracking each employees' data, and I am using this code: ...
1
vote
0answers
39 views

Displaying topics in a PHP forum

I am very new to PHP. I've only been using it for a few months. I'm currently attempting to build a forum and wanted feedback on some of the code I have so far. These are two files I feel like could ...
1
vote
2answers
52 views

Encoding multiple rows from prepared statement in php [on hold]

I have this code that hypothetically returns multiple rows from a database and encodes them in a JSON. I am wondering if this is the best and most presentable way to do it. Note: I am using msqli ...
1
vote
1answer
110 views

PHP Prepare statement shortcut class

I did some looking around and found some more topics on how to use the $stmt->bind_param function inside another function or class what means the reference variables have to be sort of passed on. With ...
1
vote
0answers
35 views

Log in page using MYSQLi

I need to review my code. I used prepared statements to select data from the database. Is there more sanitization needed or any other problem in the code? Rate it, please. Thanks. ...
1
vote
1answer
91 views

Entering users into a MySQLi database

This is a form that I want to use to enter users into a database. I used MySQLi with prepared statements. I want to make sure that I sanitized my data well. ...
-2
votes
1answer
76 views

My code is contain some vulnerabilities, how can i correct it and make it better

My code works well, but i still don't think it is well written. Can someone help to improve the code so as to get rid of vulnerabilities. My php code: ...
1
vote
1answer
222 views

Security of User Add/Edit/Delete MySQL table

I have the following code which is working fine, however I am concerned around the security of this code and considering I am relatively new to php I was wondering whether the below code is secure? I ...
5
votes
1answer
258 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 ...
2
votes
1answer
453 views

PHP > 7.1 - MySQL Session Handler Class with some built-in time-management/security

I've created a class that implements the native SessionHandlerInterface (with added PHP v7+ functionality) while adding some minor security features. My main goal was to maintain native methods for ...
11
votes
3answers
582 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 ...
2
votes
1answer
91 views

SELECT/INSERT between DB2 and MySQL

I've spent a week getting a very old script that runs between DB2 and MySQL condensed and functioning but I've been told the last few days on SO that my code is horrible and confusing and shouldn't ...
-1
votes
1answer
112 views

Displaying the value of a stock portfolio

Some people have mentioned to me that my site is quite inefficient and given that it's taking ~17secs to load now, I'd like to change that but I've no idea how. I've tried Gzip to compress it but it ...
5
votes
1answer
127 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 ...
1
vote
1answer
112 views

PHP member login system

I have php cookie based login system on my website using below given code. I want to know that whether this login system is secure or not, Whether it can be hacked in any way? ...
4
votes
1answer
2k 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: ...
1
vote
1answer
99 views

PHP exercise to read or write database values

I just came up with the code below but I'm wondering if there is room for improvement? I.e. better readability and or performance, better structure, less lines of code? The script should parse a ...
1
vote
1answer
127 views

OO and non-OO usage of Mysqli

I'm starting to learn the object oriented aspect of PHP. In this regard I made a small "exercise" of sorts "translating" one of my PHP functions into OO mode of PHP. I'm asking if there are there any ...
-3
votes
1answer
51 views

Optimize mySQL query [closed]

I have the following query: ...
-1
votes
1answer
553 views

Mysql flexible insert record with bind_param or bind_value

I want to insert rows in a database table with the precaution of SQL-injection. I'm using below flexible MySQL insert function, which enters a record in a given table. Is this the best approach or is ...
0
votes
1answer
140 views

PHP & MySQLi Login Script - Is it safe from Injection?

I've been geeking up on MySQLi prepared statements to avoid potential SQL injection and I have managed to modify my legacy code (previously just using mysqli_real_escape_string). I am looking for ...
1
vote
1answer
1k views

Separate areacode from phone number string with MySQL Database

I have a database with 5000 entries of local area codes to separate the area code from a phone number string. I'm not sure if the code I use is the fastest way to solve these job. I shrink the ...
2
votes
1answer
60 views

Switched from MySQL to MySQLi requires the connection parameter

I was working with really old PHP I learned years ago and decided to finally update it, so I changed all the mysql to mysqli. I ...
0
votes
1answer
45 views

Checking whether a user is on the donors list

I was wondering if I could please get some justification if the PHP code I wrote using Mysqli prepared statements would be able to withstand SQL injection attacks. I have one field that gets a value ...
2
votes
1answer
4k views

MySQLi query and error handling for select, insert, and update

I am creating a new webpage with database connection. I want to make sure that I am handling the MySQLi query correctly for Search, Insert, and Update. I also want to make sure if any errors do pop up,...
2
votes
2answers
729 views

Procedural function for prepared MySQL statements in PHP

I'm refactoring procedural code, switching to prepared MySQL statements using mysqli_query(). I do understand writing OO would be better, but it's out of scope for ...
0
votes
2answers
106 views

Two implementations of a PHP sign-up page

I want the most secure and well-written version for my sign-up page. I'm adding AJAX to it for validation, too. I'm still writing it. If you have tips on AJAX or on how to improve this PHP code for ...
2
votes
2answers
138 views

Email subscription queries for a PHP website

Is this code resistant against injection? I already used 'real-escape-string' but I don't know if this good enough. As you see I replaced my personal info. And the code does work. I'm building this ...
1
vote
3answers
261 views

Initializing connection to a MySQL database in PHP

I wanted to get some feedback on this way of initializing a connection to a MySQL database. File includes/db.php: ...
-1
votes
1answer
77 views

Searching for topic categories using mysqli [closed]

Is this code safe from injection, xss and whole other attacks or no ? The below code is for search box : ...
3
votes
2answers
245 views

Loading CSV into MySQL using OOP PHP

I need to make a simple CSV->MySQL script in OOP and I was wondering if there's anything I am doing wrong in a object-oriented sense. I have a file name db.php where I connect to MySQL via MySQLi and ...
0
votes
1answer
61 views

Custom MySQLi statement function for binding variables

I have the following functions: ...
4
votes
1answer
594 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
71 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
2k 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
58 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
111 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? ...
3
votes
2answers
230 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
122 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
400 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
1k 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
2k 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
53 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
631 views

Secure database connection in PHP

I have this code I use to connect to the database and get a thing from it secure, How can I make more secure?? ...