Home How to use php array with sql
Reply: 0

How to use php array with sql

user631
1#
user631 Published in April 26, 2018, 1:47 pm

I am creating an array list with AJAX. When I query SQL I get a missing list. Array's second element is not appearing in query.

ajax.php

require_once("connection.php");
$keywords = $_POST['keyword'];
$keywords = array_map("strtolower",$keywords);
$new_keyword= implode(",",$keywords );

$query = mysqli_query($connect,"select images.image_url,keyword.keyword from keyword inner join images on images.id = keyword.id where keyword.keyword in ('$new_keyword')");

$number= mysqli_num_rows($query);

output should be 1 but 2 because $keyword = ['hi','name'];

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.390572 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO