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.
257 questions
3
votes
1
answer
99
views
A function that returns correct number of inserted, updated and skipped rows for INSERT or UPDATE query
When MySQL executes a Data Modification Query, it provides some additional info on the outcome, which is usually displayed in the console. This info is also being exposed through MySQL C API and this ...
0
votes
1
answer
101
views
PHP login codes suggestions
Now i have a fully functional PHP codes for login and registeration i was wondering if anyone could offer improvements to the code
The code:
Config.php:
...
2
votes
1
answer
168
views
PHP Validation script
The code below is modified slightly from the code in this previous post.
I believe the code below could be improved and more secured but i don't know how so someone please show me how an improved ...
3
votes
1
answer
299
views
PHP MySQLi Wrapper Class For API
I've never had my code reviewed before, so I am taking this opportunity to see what can be improved with my coding style. I am still somewhat "new" to PHP, in the sense that I'm an old dog ...
4
votes
4
answers
586
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 ...
5
votes
2
answers
334
views
OOP - Contact Form PHP Backend - Procedural to OOP - Dynamic MySQL Prepared Statement PHP
I just converted procedural code to OOP code. Is there any performance or security issue with this code or what should I consider further?
interface
...
2
votes
1
answer
64
views
Input text upload to MySQL DB
I am uploading and selecting code from my MySQL DB and I have a feeling some of it could be written in a much shorter way but I don't know how. Can someone tell me if this is clean code or if it's too ...
-1
votes
2
answers
160
views
My Script Inserts users into a database and hashes the password, I need to know how to prevent SQL injection with Procedural-Oriented MySQLi [closed]
My script works but I just want to know how I can protect myself from SQL injection with Procedural Oriented MySQLi. Most of the tutorials are about Object-Oriented MySQLi and I'm not familiar with it ...
3
votes
1
answer
134
views
OOP: The correct use of classes and optimizing code
I am trying to improved my coding skills. I mainly work in web development. I had a "system" that I use in all my projects to fetch data from my DB to the browser. I tried an implementation ...
2
votes
3
answers
121
views
Receiving a user's registration submission and inserting row into database #2
I asked this question before and mickmackusa and Your Common Sense gave me some good answers. I went over them and made as much ...
1
vote
2
answers
4k
views
Return row count from mysqli prepared statement
I want to know if it is okay/safe to use a prepared statement and mysqli_num_rows like this:
...
3
votes
2
answers
395
views
messages.php file security and efficiency
I am creating a social network and I want to know how secure and clean this code is. I had to update it to prepared statements because I was following a tutorial and even though it was made in 2019 it ...
4
votes
2
answers
228
views
Security of post submission, picture upload and post fetch
I am a newbie and have been following a tutorial I bought on Udemy. But I was told it is old and teaches bad code practices. I used this in some code from my old projects. Now I'd like to know how ...
3
votes
1
answer
114
views
User Class and MySQL Connection Handler
Mainly used Stack Overflow, so first time over here for a code review. I am trying to make some enhancements to a legacy application. I have some minor experience using Laravel, but this application ...
7
votes
2
answers
873
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 ...
6
votes
3
answers
343
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 ...
2
votes
2
answers
252
views
Shoutbox system
I wrote a little Shoutbox System which is working fine, but I want to know if there is something I can improve about this code.
Here is my Shoutbox Overlay:
...
3
votes
1
answer
80
views
Creating a booking based on a POST request
I want to make a booking entry. I want to ask whether the code that i wrote below is rightly format or not?
I haven't tried it, because there's still more code that needs to be written. I just want ...
4
votes
1
answer
107
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
1
answer
90
views
Fetching table using mysqli, closing statement before displaying results
I am confused if I can do like this:
...
1
vote
1
answer
163
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
...
5
votes
2
answers
128
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
2
answers
882
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:
<...
3
votes
1
answer
147
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 ...
0
votes
1
answer
270
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 ...