I'd like to ask for help with connection/presentation of data from my database.
I have a hosted SQL database and Wordpress site, I successfully connected to my database via PHPMyAdmin, I have some content as for demonstration to try and display in list on one of the pages, I created an html block into which I typed this simple script to test connection,
<?php
$con = mysqli_connect("hostip", "username", "password", "databasename", port);
$sql = "SELECT * FROM stock_item;";
$result = mysqli_query($con,$sql);
$resultCheck = mysqli_num_rows($result);
if (0 < $resultCheck) {
while ($row = mysqli_fetch_assoc($result)){
echo $row['item_name'];
}
}
?>
but can not seem to get it to work(login details were provided by hosting provider). Any ideas or solutions please?