How can I print?

The following actually worked.

 

<html>
<head><title>Kaz's program</title></head>
<body>

Let's see.
<?php

include "ここにパスワードなどの情報があるファイルを";
$con=mysqli_connect($host,$user,$passwd,$dbname) or die ("Didn't connect, Man.");
$query="SELECT * FROM `vocab_list` where ID < 10";
$result=mysqli_query($con,$query)
or die ("Didnt work.");
$row=mysqli_fetch_assoc($result);

ここで、書きだしたいものの、以下のではだめのようです。
echo $row['word'];

?>

Does this print?
</body></html>

MySQL error

I kept getting an error message from this:

$query = "SELECT * FROM 'questions' WHERE question_number= $number";

You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ''questions' WHERE question_number= 1' at line 116

I removed 's from the statement and it started working without an error message.

$query = "SELECT * FROM questions WHERE question_number= $number";

php & MySQL practice (it worked!)

 

index.php

<html>
<head>
<title>Insert Form Data In MySQL Database UsingPHP </title>
</head>
<body>

<form action="insert.php" method="post">

Name : <input type="text" name="username">
<br/>
Email: <input type="text" name="email">
<br/>
<input type="submit" value="Insert">
</form>

</body>
</html>

****

insert.php

<?php

$con = mysqli_connect('localhost','root','');

if(!$con)
{
echo "Not connected to server";
}

if(!mysqli_select_db($con,'tutorial'))
{
echo 'Database Not Selected';
}

$Name = $_POST['username'];
$Email= $_POST['email'];

$sql="INSERT INTO person (Name,Email) VALUES ('$Name','$Email')";

if (!mysqli_query($con,$sql))
{
echo 'Not inserted';
}
else
{
echo 'Inserted';
}
/*
header("refresh:2; url=index.php");
*/
?>

 

My PHP program doesn't run

FIRST FILE: index.php

<!DOCTYPE html>
<html>
<head>
<title>
Test program
</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>

<a href="http://www.nippondream.com\testitems\01a.mp3">Play the tape</a>

<form action="insert.php" method="POST">
Please choose the right answer!!!!

<table style="width: 20%">
<tr>
<th>Right <input type="radio" name="a" value="a" required/> </th>
<th>Light<input type="radio" name ="b" value="b" required/> </th>
<th>Can't tell<input type="radio" name ="c" value="c" required/> </th>
</tr>
</table>
<input type="submit" value="Enter"/>
</form>

</body>
</html>

 

********************

SECOND FILE: insert.php

<html>
<body>

<?php

$conn = mysqli_connect("localhost","root","","quizbank");
mysqli_query($conn, "SET NAMES 'UTF8'") or die("ERROR: ". mysqli_error($conn));

$sql="INSERT INTO users (user_id,item_id,response)
VALUES
('$_POST[a]','$_POST[b]','$_POST[c]') ";

if (!mysql_query($sql,$conn))
{
die('Error: ' . mysql_error());
}
echo "1 record added";
mysql_close($conn)

?>

</body>
</html>