Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Selecting multiple ID's using IN(2.5.6) for example

Featured Replies

Hi guys,

 

I cant figure this one out.

 

$result = mysql_query("SELECT jobalert.id, firstname, lastname, email, mobile, jobSectorid, location, date FROM jobalert WHERE jobalert.id IN(1,13,21) ORDER BY lastname");

 

Running this work fine, and three rows are selected, but I need to use a variable I have created for the in part like this

 

$result = mysql_query("SELECT jobalert.id, firstname, lastname, email, mobile, jobSectorid, location, date FROM jobalert WHERE jobalert.id IN('$part') ORDER BY lastname");

 

$part = '1,13,21';

 

I only ever get the row with the ID of 1 returned using the last statement. How do I go about getting it to select 2 lines or more using the variable $part.

 

Cheers

Edited by tangerine_dreamer

  • Author

you need to remove the ' from either side of the $part, as it thinks it's a string

Be sure to sanitize your data since you are doing this, to avoid mysql injection in the real version

 

Thanks a lot for the quick response! So simple! Fully working now!

 

Thanks again

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.