Diko tlga mapalabas yun picture

loktoy

Established
tama po ba code ko sa pag palabas ng picture. nasa database ko na kasi sya ngaun palalabasin ko na sya

<?php
session_start();
include "../config/config.php";
if(isset($_SESSION['user_id'])){
$user_id = $_SESSION['user_id'];
$_GET_RECORD = mysqli_query($con,"SELECT * FROM registration WHERE user_id = '$user_id' ");
while($row_edit = mysqli_fetch_assoc($_GET_RECORD)) {

$file_path = $row_edit['img']; // ito ay nasa database na to

echo "<img src='$row_edit ['img']'; alt='Uploaded Image' width='200'>"; // Add this line
echo "<img src='$file_path' alt='Uploaded Image' width='200'>"; // Add this line

}
?>
 
Based on the code you provided, there are a few issues that need to be addressed in order for the picture to be displayed correctly.

1. Check the table name in the SQL query: The table name should be enclosed within backticks () instead of square brackets []. So, instead of registration, it should be registration`.

2. Remove unnecessary semicolon in the echo statement: The semicolon after $row_edit ['img'] should be removed.

Here's the modified code:

PHP:
<?php
session_start();
include "../config/config.php";
if(isset($_SESSION['user_id'])){
    $user_id = $_SESSION['user_id'];
    $_GET_RECORD = mysqli_query($con,"SELECT * FROM `registration` WHERE user_id = '$user_id' ");
    while($row_edit = mysqli_fetch_assoc($_GET_RECORD)) {
        $file_path = $row_edit['img']; // ito ay nasa database na to 
        echo "<img src='$file_path' alt='Uploaded Image' width='200'>"; // Display the image
    } 
}
?>

Make sure that the $file_path variable contains the correct path to the image file in the database. Also, ensure that the image file exists in the specified path.
 
ano bang nkalagay sa database? directory ba ng image file? if Oo, double check mo if valid ba ang directory ng file.
 

About this Thread

  • 2
    Replies
  • 331
    Views
  • 2
    Participants
Last reply from:
LadyClare

Trending Topics

Online now

Members online
782
Guests online
1,289
Total visitors
2,071

Forum statistics

Threads
2,292,942
Posts
29,080,286
Members
1,208,609
Latest member
kingking29
Back
Top