CodeAndCoins Forum

Official Forum of YouTube/CodeAndCoins Channel

If you got any problem while coding with me on my youtube video then come here
#26
hey guys, i create a database in phpadmin , it name is "db" and i followed the same code using in this video https://www.youtube.com/watch?v=bHFoobciCTM and nothing !!
this is the message that i received when i run my code :

connect_error) { die("connection failed:". $conn-> connect_error); } $sql = "SELECT id, nom, prenom, password, id_classe from etudiant"; $result = $conn-> query($sql); if ($result-> num_row > 0) { while ($row = $result-> fetch_assoc()) { echo ""; } echo "
id nom prenom password id_classe
". $row["id"] ." ". $row["nom"] ." " .$row["prenom"] ." " .$row["password"] ." " .row["id_classe"] ."
"; } else{ echo"0 result"; } $conn-> close(); ?>

and this is my code :
<!DOCTYPE html>
<html>
<head>
<title>table with database</title>
</head>
<body>
<table>
<tr>
<th>id </th>
<th>nom </th>
<th>prenom </th>
<th>password </th>
<th>id_classe </th>
</tr>
<?php
$conn =mysql_connect("localhost", "root", "", "db");
if ($conn-> connect_error) {
die("connection failed:". $conn-> connect_error);
}

$sql = "SELECT id, nom, prenom, password, id_classe from etudiant";
$result = $conn-> query($sql);

if ($result-> num_row > 0) {
while ($row = $result-> fetch_assoc()) {
echo "<tr><td>". $row["id"] ."</td><td>". $row["nom"] ."</td><td>" .$row["prenom"] ."</td><td>" .$row["password"] ."</td><td>" .row["id_classe"] ."</td></tr>";
}
echo "</table>";
}
else{
echo"0 result";
}
$conn-> close();
?>


</table>

</body>
</html>

PLEASE HELP I HAVE A PROJECT AND I NEED TO CONNECT DATA WITH CODE !! THANK YOU
#32
my database's name is db
there are many tables in it, one of them called "etudiant"
and this table had infos : id, nom, prenom, password, id_classe . and all of theme had value
i think my code is correct i don't know where is the problem !
can you text me in my gmail to help me on this if you can ofc
[email protected]
Attachments
Capture2.PNG
Capture2.PNG (22.47 KiB) Viewed 2567 times
Capture.PNG
Capture.PNG (54.24 KiB) Viewed 2567 times

Are you able to visit phpMyadmin page?

Intro

Hi, I'm Jef. I've been living in Thailand for the […]

If browser return php code, that means php code is[…]

Forum rule

Be Kind and Courteous -We're all in this together […]