Hi all, i have the following issue.
Issue: Query return zero row using notORM.
Steps taken to fix it but didnt work:
Code:
require 'NotORM.php';
$conn = new PDO($dsn, $db_username, $db_password) or die ("can't connect");
$db = new NotORM($conn) or die ("instance not created");
$rates = array();
foreach($db->rates_call() as $rate)
{
$rates[] = array(
"country_name" => $rate[country_name],
"rate" => $rate[rates]
);
echo "in foreach loop";
}
echo json_encode($rates);
Based on the code, the foreach loop not executed bcoz the no. of row returned is zero but in my database table, having few line of rows. I already tried using PDO aswell, it returned zero result also. Appreciate your assistant.
I did silly mistake at my PDO connection...
I wrote:
$dsn = 'mysql:host:localhost;dbname=dtbasname';
It should be like this
$dsn = 'mysql:host=localhost;dbname=dtbasname';
I accidentaly wrote ':' instead of '=' in between host and localhost.