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
3
votes
1answer
42 views

Displaying a user's uploaded posts

I'm working on prepared statements for my website and I'm wondering if it's possible to have multiple prepared statements one after another. In this example, I have 2 select statements. I'm hoping ...
1
vote
2answers
56 views

Inserting a user sign-up record using mysqli

My Code: Connectivity(php) ...
1
vote
1answer
46 views

Fetching table using mysqli, closing statement before displaying results

I am confused if I can do like this: ...
1
vote
1answer
70 views

PHP MySQLi Prepared Statements: Can this select query be hacked/injected?

i want to know can this be hacked/injected? ...
1
vote
1answer
67 views

Simple MySql or MySqli Class

Which one of these methods is better/safer to use? And what benefits could I get using one or other? Simple mysqli: connection.php ...
2
votes
2answers
90 views

PHP New User Creation

I'm learning more about PHP, so I've decided to create a simple login/create account system. Entering information for creating a new account sends the data to my ...
5
votes
2answers
73 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 ...
1
vote
1answer
51 views

When slide show web page is reopen, the web page loading is very slow

Here is a script that opens about 200 pictures, the first time you open the webpage, loading of the 200 pictures is fast, However if you reopen the page, it takes about 4 minutes to load the same page ...
1
vote
2answers
152 views

Simple wrapper for PHP mysqli connection

I'm creating some web apis to sync some data between desktop/mobile apps. Working on it, I wrote a simple wrapper for mysqli connection to simplify querying like: <...
2
votes
1answer
191 views

Using singleton pattern for a MySQL connection

I'm new to web programming, and writing some web apis to enable users to sync their data between devices. Is it okay to use singleton pattern to prevent reconnecting the MySQL database on every api ...
3
votes
1answer
95 views

Authentication system (no browser) with mail verification

I made an authentication system for my software (no browser is used) that works like this: User receives a Key on it's mail after buying the software User registers account using that key and inputs ...
2
votes
3answers
232 views

Adding / updating user info into MySQL database

I'm working on an app that will be used for employee management and I'm using MySQL for the database. You can add employees, view/update/delete them, and on the dashboard I'm listing them in different ...
0
votes
1answer
70 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
178 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 ...
1
vote
2answers
123 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
972 views

PHP login script using mysqli

Can you guys tell me if my login is secure? Login.php ...
2
votes
1answer
57 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
62 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
72 views

Tracking employee data

We have hundreds of employees and for tracking each employees' data, and I am using this code: ...
1
vote
0answers
47 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
101 views

Encoding multiple rows from prepared statement in php [closed]

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
428 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
36 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
96 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
692 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
404 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 ...
3
votes
1answer
1k 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
651 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
116 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 ...
0
votes
1answer
125 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
149 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
132 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
5k 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
115 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
151 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
53 views

Optimize mySQL query [closed]

I have the following query: ...
-1
votes
1answer
950 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
162 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
80 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
6k 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
1k 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
114 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
191 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
433 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
108 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 : ...
2
votes
2answers
338 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
71 views

Custom MySQLi statement function for binding variables

I have the following functions: ...