how to receive a mysql query by passing a parameter,receive that user's data in a list

private async void llenarListView()
{
try
{
userManager manager = new userManager();
var result = await manager.pasaracjaCompra(txtahora.Text.ToString());
if (result != null)
{
lsUsuarios.ItemsSource = result;
}
}
catch (Exception e1) { }
}

<?php

$usuario=$_REQUEST['usuario'];
$cnx=new PDO("mysql:host=localhost;dbname=nxf344","xc310344","nuevo123");
$res=$cnx->query("select * from carrito where usuario='$usuario'");

$datos=array();

foreach ($res as $row ) {
array_push($datos,array(
'codigo_Pro'=>$row['codigo_Pro'],
'producto'=>$row['producto'],
'cantidad'=>$row['cantidad'],
'precio'=>$row['precio'],
'total'=>$row['total'],
'usuario'=>$row['usuario'],

));

}
echo utf8_encode(json_encode($datos));
?>

Tagged:

Answers

  • ColeXColeX Member, Xamarin Team Xamurai

    What exact problem did you meet? Is there any error message ?

Sign In or Register to comment.