Passing multiple instruments from database table to getQuote function not working

akshitahuja
akshitahuja edited March 2018 in PHP client
<?php
include "../kiteconnect.php";

$kite = new KiteConnect("xxx");

$kite->setAccessToken('xxx');

echo "Quote: \n";
$conn = mysqli_connect('localhost', 'root', '', 'stocks');

$qr = mysqli_query($conn, "SELECT * FROM instruments LIMIT 500");
$ins = '';
while ($rs = mysqli_fetch_assoc($qr)) {
if ($ins == '') {
$ins = '"NSE:'.$rs['name'].'"';
}
else {
$ins .= ', "NSE:'.$rs['name'].'"';
}
}

print_r($kite->getQuote([$ins]));
?>
Here is my code. When I am passing multiple instruments like:
print_r($kite->getQuote(["NSE:INFY", '"NSE:3IINFOTECH"]));
it works fine, but the same thing when i do by fetching instruments from database it returns empty array.

Where i am doing wrong
Tagged:
Sign In or Register to comment.