First of all i'm kind of a newbie to PHP and MySQL. My php script connected to database successfully but i have problem with executing query. Problem is that my script went normally until 'echo " A ";' and than stops. Script never reach line 'echo " B ";'.
My PHP code:
<?php
$servername = "****";
$username = "****";
$password = "****";
$db_name = "****";
// Create connection
$conn = mysqli_connect($servername, $username, $password ,$db_name);
// Check connection
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
echo "Connected successfully";
$sql = "SELECT * FROM street";
$result = $conn->query($sql);
if (!$result) {
echo "DB Error, could not query the database\n";
echo 'MySQL Error: ' . mysql_error();
exit;
}
else{
echo " A ";
$row = mysql_fetch_assoc($result);
echo " B ";
}?>
Maybe i has something to do with the ' * ' sign at the start of the line but im stucked with it
My Query to creation of table and nothing else was inserted.
CREATE TABLE point_of_interest.City(
Id serial PRIMARY KEY,
Id_country INT REFERENCES Country(id),
City_name VARCHAR (60) )
Also when i do SELECT COUNT(*) FROM street; it shows 0 rows at MySQL Workbench.
MySQL version 8.0