I am trying to conctenate/embed database value from php script into my api URL but i don't know how to get it right, I am not familiar with php
it needs to embed the varible from DB in order to access API values like this api/rfq/1 (example)
I tried this so far
php code:
<?php
require_once('connection.php');
session_start();
if(!$con){
die('Please Check Your Connection'.mysqli_error());
}else{
$query="select BusinessID from business where username='".$_SESSION['User']."'";
$result=mysqli_query($con,$query);
while($row =mysqli_fetch_array($result)){
$results[]=implode($row['BusinessID']);
}
echo json_encode($results);
// echo 'Works ASF '+$hey;
}
?>
jQuery file:
$(function() {
$.getJSON('getID.php', function(data) {
$.each(data, function() {
alert(data.column);
})
})
var $hello = $('#hello');
$.ajax({
type: 'GET',
dataType: "json",
url: 'http://slimapp/api/rfq/"'+$_SESSION['User']+'"',
success: function(hello){
$.each(hello, function(i,order){
$hello.append('<div class="panel panel-default"><div class="panel-thumbnail"></div><div class="panel-body"><p class="lead"><b><img src="assets/img/Profile.png" height="28px" width="28px">'+order.Title+'<a href="#postModal" class="pull-right" role="button" data-toggle="modal"><i class="glyphicon glyphicon-plus"></i>Make Bid</a></b></p><p><img src="assets/img/RFQ.png" height="28px" width="28px">'+order.Description+'</p><p><img src="assets/img/Clock.png" height="28px" width="28px">'+order.Date+'</p><hr/><p><img src="assets/img/email.png" height="28px" width="28px"><a href="https://mail.google.com/mail/?view=cm&fs=1&to=someone@example.com&su=SUBJECT&body=BODY&bcc=someone.else@example.com">'+order.email+'</a></p><p><img src="assets/img/Phone.png" height="28px" width="28px"><a href="">'+order.cellphone+'</a><p><textarea class="form-control" placeholder="Comment"></textarea><br/><li id="btn1"></li><button class="btn btn-success pull-left" type="button" style="border-radius:12px">Comment</button></p></div></div>');
})
}
})
});
I expect to get data from url like this
http://slimapp/api/rfq/1