Responsive Display Picture in Profile with Change Photo in PHP/MYSQLi
Good day everyone. This tutorial entitled Responsive Display Picture in Profile with Change Photo in PHP/MYSQLi will teach you on creating a responsive display profile with a feature change photo for your profile page.
So let’s start now our tutorial.
So first, please download this. dp-design .
Extract the zip file. All the contents there are the CSS and javascript needed for a responsive display picture when it is clicked.
Now let’s proceed to the system codes.
Step by Step process to perform this project.
Step 1. First of all, create a database. Name it as any name you desire, in my case I choose “itsourcecode” as the name of the database.
Step 2. Then create a table, name it as “avatars” then put the following attributes.
CREATE TABLE `avatars` ( `ava_id` int(11) NOT NULL, `ava_link` text NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
Step 3. For the connection to the database. Create a “conn.php” file then put the following codes.
<?php
$conn = new mysqli('localhost', 'root', '', 'itsourcecode');
if ($conn->connect_error) {
echo $conn->error;
}
?>
Step 4. On your profile page. Please put the following codes.
<?php include 'conn.php'; ?>
<html><html> <head> <meta charset="UTF-8"> <title>Responsive Profile</title> <link href="assets/css/bootstrap.css" rel="stylesheet" type="text/css"/> http://assets/fancybox/jquery.fancybox-1.3.4.pack.js <link href="assets/fancybox/jquery.fancybox-1.3.4.css" rel="stylesheet" media="screen" type="text/css"/> http://assets/slimbox/jquery.min.js http://assets/slimbox/slimbox2.js <link href="assets/slimbox/slimbox2.css" rel="stylesheet" type="text/css"/> $(document).ready(function() {
$("#various1").fancybox({ 'titlePosition' : 'inside', 'transitionIn' : 'none', 'transitionOut' : 'none' });
$("#various2").fancybox();
$("#various3").fancybox({ 'autoScale' : true, 'transitionIn' : 'none', 'transitionOut' : 'none', });
$("#various4").fancybox({ 'padding' : 0, 'autoScale' : false, 'transitionIn' : 'none', 'transitionOut' : 'dissolve' }); $("#various5").fancybox({ 'autoScale' : true, 'transitionIn' : 'none', 'transitionOut' : 'none', });$("#various6").fancybox({ 'autoScale' : true, 'transitionIn' : 'none', 'transitionOut' : 'none', });$("#various7").fancybox({ 'autoScale' : true, 'transitionIn' : 'none', 'transitionOut' : 'none', }); $("#various8").fancybox({ 'autoScale' : true, 'transitionIn' : 'none', 'transitionOut' : 'none', });$("#various9").fancybox({ 'autoScale' : true, 'transitionIn' : 'none', 'transitionOut' : 'none', });$("#various10").fancybox({ 'autoScale' : true, 'transitionIn' : 'none', 'transitionOut' : 'none', });$("#various11").fancybox({ 'autoScale' : true, 'transitionIn' : 'none', 'transitionOut' : 'none', });$("#various12").fancybox({ 'autoScale' : true, 'transitionIn' : 'none', 'transitionOut' : 'none', });$("#various13").fancybox({ 'autoScale' : true, 'transitionIn' : 'none', 'transitionOut' : 'none', }); }); <style> body { padding-top: 10px; } .ava { background-color: #ffffff; border: 1px solid #c0c0c0; } </style> </head> <body>
query("SELECT * FROM avatars ORDER BY ava_id DESC"); $ava_data = $ava->fetch_assoc(); if ($ava->num_rows == null) { $ava_img = "images/user-ava.png"; } else { $ava_img = $ava_data['ava_link']; } ?> " rel="lightbox-gallery" title="">
" width="200px" class="ava"/>
Change Photo
Name: Harley F. Lumagui
Age: 19
Gender: Male
Civil Status: Single
</div> </body></html>
Step 5. For changing a photo. Create a “change-photo.php” file then put the following codes.
<?php
include 'conn.php';
?>
<html>
<head>
<meta charset="UTF-8">
<title>Change Photo</title>
<link href="assets/css/bootstrap.min.css" rel="stylesheet" type="text/css"/>
<style>
body {
padding-top: 10px;
}
.ava {
background-color: #ffffff;
border: 1px solid #c0c0c0;
}
</style>
</head>
<body>
Your current avatar:
query("SELECT * FROM avatars ORDER BY ava_id DESC");
$ava_data = $ava->fetch_assoc();
if ($ava->num_rows == null) {
$ava_img = "images/user-ava.png";
} else {
$ava_img = $ava_data['ava_link'];
}
?>
" width="200px" class="ava"/>
query("INSERT INTO avatars (ava_link) VALUES ('$ava_link')");
if ($upload) {
header("Location: index.php");
} else {
echo $conn->error;
}
}
}
?>
</div>
</body>
</html>
Done.
When you complete this tutorial, you will be able to make your own social networking site like facebook. You can try to visit here the application of uploading the image in the user profile.
For more Resources of a complete system using PHP, you check it here PHP Projects with Source Code-free to Download.
Screenshots:
Inquiries
If you have questions regarding this tutorial entitled as “Responsive Display Picture in Profile with Change Photo in PHP/MYSQLI” feel free to ask us by commenting below or visit on our contact page. Thank you.
Suggested Topics
Frequently Asked Questions
How does this PHP project work?
Built with vanilla PHP (no framework) and MySQL backend. Standard structure: form HTML, PHP script handlers, MySQL via PDO or mysqli, sessions for auth, Bootstrap for responsive layout. Ready to extend for BSIT capstone scope.
What PHP and MySQL versions does this project require?
Most projects in this batch run on PHP 7.4 to PHP 8.2 with MySQL 5.7+ or MariaDB 10+. A few older projects need PHP 5.6 (deprecated, use XAMPP 7.x). To run: install XAMPP / WAMP / Laragon, extract project to htdocs, import the included .sql file via phpMyAdmin, edit the connection file (usually config.php or db_connect.php) with your DB credentials, browse to the project URL in your browser.
How do I set up the database for this PHP project?
Open phpMyAdmin (http://localhost/phpmyadmin/ on XAMPP), create a new empty database with the name specified in the project’s config.php. Click the Import tab, choose the included .sql file, click Go. Then edit config.php (or includes/connection.php) with: ‘localhost’, your MySQL username (usually ‘root’), your MySQL password (usually blank for XAMPP), and the database name.
Can I use this PHP project for a BSIT capstone or thesis?
Yes, but extend it. A bare CRUD app is too narrow for full capstone scope. Add: user roles via session checks, reports/dashboards (Chart.js + AJAX), PDF exports (TCPDF library), email notifications (PHPMailer), real domain extension (analytics, audit log, multi-branch support). Pair with Chapter 1-5 documentation matching your panel’s rubric.
Why am I getting ‘connection error’ or ‘undefined function mysqli_connect’?
Three common PHP issues: (1) Connection error: Apache + MySQL services not running in XAMPP control panel, OR database name in config.php does not match what you created in phpMyAdmin. (2) ‘undefined function mysqli_connect’: MySQL extension not enabled, in php.ini uncomment extension=mysqli (then restart Apache). (3) ‘No such file or directory’: MySQL socket path wrong, use 127.0.0.1 instead of localhost in the connection string.
Where can I find more PHP projects with source code?
Browse the PHP Projects hub for the full library (300+ vanilla PHP systems). For modern PHP MVC alternatives see Laravel Projects (74 systems) or CodeIgniter Projects (32 systems). For BSIT-focused capstone idea lists see 150 Best Capstone Project Ideas.







