android - php fetch mysql data by user id -
this php url fetching data mysql. need make mysqli_fetch_array
code saying if filled uid
in app-data
table same uid
in users
table fetch data row in app-data
uid
every user show items app-data
table.
$host = ""; $user = ""; $pwd = ""; $db = ""; $con = mysqli_connect($host, $user, $pwd, $db); if(mysqli_connect_errno($con)) { die("failed connect mysql: " . mysqli_connect_error()); } $sql = "select * app_data order id"; $result = mysqli_query($con, $sql); $rows = array(); while($row = mysqli_fetch_array($result, mysqli_assoc)) { $rows[] = $row; } mysqli_close($con); echo json_encode($rows);
i think correct answer:
<?php $host = ""; $user = ""; $pwd = ""; $db = ""; $con = mysqli_connect($host, $user, $pwd, $db); if(mysqli_connect_errno($con)) { die("failed connect mysql: " . mysqli_connect_error()); } $sql = "select * app_data u_id=".$_post['posted_uid']." order id"; $result = mysqli_query($con, $sql); $rows = array(); while($row = mysqli_fetch_array($result, mysqli_assoc)) { $rows[] = $row; } mysqli_close($con); echo json_encode($rows);
little tip future:
don't search want, search in parts.
Comments
Post a Comment