+ 1

MYSQL Database

https://code.sololearn.com/w4IoM4mu7BGb/?ref=app i have a problem in this part while ($row = $result->fetch_assoc() ) { echo "<h3 >" . "<i class='far fa-user'>" . " " . "hi," . $row['username'] . " " ."Welcome to the market for your touches" . "</i>" . "</h3>"; } Is not run please help me

16th Jul 2020, 6:09 PM
Sarah Hasan
11 Answers
+ 1
Sarah Hasan seems then like your program works fine. Have you checked if the infouser table is not empty or if it contains any record with id of $idusers? If possible can you share your complete code or a more complete version of your code so I can know what $idusers is?
17th Jul 2020, 6:42 PM
Ore
Ore - avatar
+ 2
Sarah Hasan It's so nice to know that I was of help.
17th Jul 2020, 7:55 PM
Ore
Ore - avatar
+ 1
It is because mysqli_query does not return an object so you can not call fetch_assoc on null Change mysqli_query($conn, $sql) to $conn->query($sql)
16th Jul 2020, 9:01 PM
Ore
Ore - avatar
+ 1
I tried to replicate it in my machine and it works. Can you tell what errors exactly you are getting. If you are not getting any errors. Type the following in your code's first line <?php error_reporting(-1); ini_set('display_errors', 1); Only if you are not getting any errors
17th Jul 2020, 6:23 AM
Ore
Ore - avatar
0
Ore No change I've tried before
16th Jul 2020, 11:55 PM
Sarah Hasan
0
yes there is no error
17th Jul 2020, 6:26 PM
Sarah Hasan
0
nothing happened
17th Jul 2020, 6:27 PM
Sarah Hasan
0
Well in that case what does your program print? If there is no error the response will be either 1. Data selected 2. No data 3. Data selected and "hi user, welcome to...."
17th Jul 2020, 6:37 PM
Ore
Ore - avatar
0
just print data selected
17th Jul 2020, 6:38 PM
Sarah Hasan
0
Ore thank you my problem is solved $idusers in the session have same name
17th Jul 2020, 6:58 PM
Sarah Hasan
0
I interested to know brefly about database
2nd Mar 2024, 8:35 PM
Eyuel Felek
Eyuel Felek - avatar