<?php
$dbc = mysqli_connect('127.0.0.1', 'root', 'apmsetup', 'sh')
or die('Error Connecting to MySQL server.');
mysqli_query($dbc, "set names utf8;");
$title = $_POST['item_title'];
$query = " select * from db where title LIKE '%title%' ";
$result = mysqli_query($dbc, $query)
or die('Error Querying databases.');
$json = array();
if(mysqli_num_row($result)){
while($row=mysqli_fetch_assoc($result)){
$json['list'][] = $row;
}
mysqli_free_result($result);
}
echo json_encode($json);
mysqli_close($dbc);
?>
The code is a query that allows me to get the value of title using param.put("item_title",title) from the android java file and get all the values that match the value from the title column. Please check if any of the above codes have a grammar error. I don't think there's anything wrong with the quotation marks of SELECT inquiries, but I don't know exactly where the error occurs.
php android
Does error in the question mean something that cannot be asked?
I'm not sure if it's not worth it.
First of all, please revise the following query as below.
$result = mysqli_query($dbc, $query)
or die('Error Querying databases.');
$stmt = $dbc->prepare("SELECT * FROM db WHERE title LIKE ?");
$stmt->bind_param("s","%{$title}%");
$stmt->execute(); // or die('Error Querying databases.');
$result = $stmt->get_result();
© 2024 OneMinuteCode. All rights reserved.