vendredi 1 janvier 2016

PHP not fetching data from online MYSQL database

Hosting a website on bigrock. Image below shows the servername, username, dbName, tableName and tableStrucutre

[see image]

The table contains two rows, but my PHP code is unable to fetch anything.

Code:

<?php
$servername = "208.91.198.197:3306";
$username = "sr";
$password = "##";
$dbName = "srohi5";

// Create connection
$conn = new mysqli($servername, $username, $password, $dbname) or die("Connection failed: " . $conn->connect_error);

$sql = " SELECT * FROM charities ";
$result = $conn->query($sql);

echo intval($result->num_rows);
$conn->close();
?>

It is able to establish a connection with the database, but is unable to execute/fetch any data. The output is:

0

Please help!




Aucun commentaire:

Enregistrer un commentaire