Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8862559
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T15:45:29+00:00 2026-06-14T15:45:29+00:00

I have a PHP script that sends out push notifications to certain device tokens,

  • 0

I have a PHP script that sends out push notifications to certain device tokens, and after it has been sent, sets a variable in a column matching up with that row so that the script skips over it the next time it sends out notifications.

The table looks like this:

Token (PRIMARY)     School        Skip
--------------------------------------
f2342f              School 2      0
434fbc              School 1      0
33332c              School 1      0

I set the Skip column variable to 1 after the code has been run to send the notifications:

if (!mysql_query("UPDATE Snow SET Skip='1' WHERE Token IN('$tokens')", $con)) {
    die('Error: ' . mysql_error());
}

The problem with that though is that if two tokens share the same school, then it won’t update. Is it possible for it to update when there are multiple “tokens” in the array? So for that query to update not only single tokens, but multiple ones separated by a comma:

UPDATE Snow SET Skip='1' WHERE Token IN('f2342f') // Single tokens matching criteria
UPDATE Snow SET Skip='1' WHERE Token IN('434fbc, 33332c') // Multiple tokens
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T15:45:30+00:00Added an answer on June 14, 2026 at 3:45 pm

    Yes, you should wrap all tokens in quotes so you’ll get ‘434fbc’, ‘33332c’:

    $tokensStr = "'" . join("','", explode(",", $tokens)) . "'";
    if (!mysql_query("UPDATE Snow SET Skip='1' WHERE Token IN($tokensStr)", $con)) {
        die('Error: ' . mysql_error());
    }
    

    And if $tokens comes directly from user input:

    $tokenArray = explode(",", $tokens));
    $tokenArray = array_map('mysql_real_escape_string', $tokenArray);
    $tokensStr = "'" . join("','", $tokenArray) . "'";
    if (!mysql_query("UPDATE Snow SET Skip='1' WHERE Token IN($tokensStr)", $con)) {
        die('Error: ' . mysql_error());
    }
    

    This prevents SQL injections: http://en.wikipedia.org/wiki/SQL_injection

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a php script that sends out emails with attachments once people have
I have a script that sends out a push notification to users based on
I have a PHP Mail script that sends out emails and I need to
I have a PHP script that I'm invoking from another shell script that sends
So, I have a php script that sends my mp3 file to the audio
I have a simple php script on my domain that sends me an email:
I have a jquery-ajax function that sends data to a php script and the
I have this jQuery script that sends a username an password to a PHP
Possible Duplicate: Sending mass email using PHP I have a PHP script that sends
I have a rough php script that sees if a user has filled in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.