I am trying to display a certain row of one of the tables in my database.
Here is my code for it:
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
else printf("Connection Successful");
mysql_select_db('magento');
$query = "SELECT * FROM poll_answer";
$result = mysqli_query($query);
while($poll=mysqli_fetch_assoc($result)){
echo "<tr>" .$poll['answer_title']. "</td>";
}
And here is my table:
+--------------+------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+--------------+------------------+------+-----+---------+----------------+
| answer_id | int(10) unsigned | NO | PRI | NULL | auto_increment |
| poll_id | int(10) unsigned | NO | MUL | 0 | |
| answer_title | varchar(255) | YES | | NULL | |
| votes_count | int(10) unsigned | NO | | 0 | |
| answer_order | smallint(6) | NO | | 0 | |
+--------------+------------------+------+-----+---------+----------------+
I cannot get to print anything but "Connection Successful"!
Can anyone tell me what is possibly wrong?
EDITED SQL to SQLI, still same problem