Note that there are some explanatory texts on larger screens.

plurals
  1. POadding array value to a where clause
    primarykey
    data
    text
    <p>with this code.. I need to add $code variable to a sql query's where clause. </p> <pre><code>if ( isset( $_POST['code_search_submitted'])) { if ( isset( $_POST['searchCode']) &amp;&amp; !empty( $_POST['searchText'])) { $searchCode = $_POST['searchCode']; $searchText = $_POST['searchText']; echo $searchCode; echo '&lt;br /&gt;'; echo $searchText; //if (is_numeric( $searchText ) &amp;&amp; (strlen($searchText) == 4)) { $numbers = explode(",", $searchText); foreach($numbers as $number) { $numbers = trim($number); if (ctype_digit($numbers) &amp;&amp; (strlen($numbers) == 4)) { $code = $numbers ; } else { echo 'Can not cantain string and more than 4 digists number'; } } } } </code></pre> <p>this is my query...</p> <pre><code>SELECT tcs.tutor_id AS tid, t.qualification, GROUP_CONCAT( DISTINCT o.option_name SEPARATOR ', ') AS tutor_option, timg.image_name AS img, city_name AS city, d.district_name AS district FROM tutor_category_subject as tcs INNER JOIN subject AS s ON tcs.subject_id = s.subject_id INNER JOIN tutors AS t ON tcs.tutor_id = t.tutor_id INNER JOIN address ON address.address_id = t.address_id INNER JOIN city ON city.city_id = address.city_id INNER JOIN district AS d ON d.district_id = city.district_id LEFT JOIN tutor_images AS timg ON timg.tutor_id = tcs.tutor_id AND timg.image_type = 'profile' WHERE t.tutor_code = ------------ GROUP BY tcs.tutor_id; </code></pre> <p>$code variable have more member codes like this 2434,2345,5345,2354, etc... can anybody tell me how can I use this in my where clause?</p> <p>Thank you...</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload