I imported a database to my PHPmyadmin in which works well but when I try to display with
my php file, i don’t get true, the only I see is the field’s line on the top.
hier is my app;
<?php
DEFINE('db_name', 'root');
DEFINE('db_pass', 'root');
DEFINE('db_host', 'localhost');
DEFINE('db_database','SCV_DB');
$dbcon =mysqli_connect("localhost", "root", "root", "SCV_DB");
if (mysqli_connect_error()) {
die('Connect Error ('.mysqli_connect_errno().') '.mysqli_connect_error());
}
$color=' well come to mysql';
echo 'Connected successfully<br>';
echo 'M. Mori ' . $color.'<br>';
mysqli_set_charset($dbcon,"utf8");
echo "<table><tr><th>SECTION</th><th>NAME</th><th>DATE</th><th>COUNTRY</th><th>PREIS</th></tr>";
$consult="SELECT * FROM TABLE 1";
$result=mysqli_query($dbcon,$consult);
while($row = mysqli_fetch_row($result)) {
echo "<tr><td>";
echo $row[0]."</td><td>";
echo $row[1]."</td><td>";
echo $row[2]."</td><td>";
echo $row[3]."</td><td>";
echo $row[4]."</td></tr>";
}
echo "</table>";
?>
5
Answers
Hier is the database;
I hope this help for solve the problem.
I hate mysqli procedural style, you should be using Object oriented style much more usefull here you can find more.
Anyway! I was playing with procedural connections and saw your question hope its not a dupliacte one 🙂
So here is connetction file what I was playing with! you can use your own connection.
Here is the query with prepare statements (prepare statements avoid you from sql injections espacialy when updating and inserting data)
I should in the first post explained better my problem. Well this file was an excel file.xls and i use Mac,so to use that in phpmyadmin, first i should convert it to CSV file than importe it, that wasn’t any problem because i can see perfectly the database in phpmyadmin but when I try to display it by php in the browser, I don’t
get true.
just renaming the table solved the problem.