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

  • Home
  • SEARCH
  • 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 4272376
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T07:34:10+00:00 2026-05-21T07:34:10+00:00

how do i compare the with if else statement. in mysql query i can

  • 0

how do i compare the with if else statement. in mysql query i can use LIKE % statement.
i want to compare the string result with php.
ie: Pro Tan 3mins, Pro Tan 6mins, Pro Tan 9mins

in mysql :

$db->query("SELECT * FROM treat WHERE tanning LIKE 'Pro Tan%'");

in php:

if($tanning == 'Pro Tan') :
  echo 'xxx';
else :
  echo 'zzz';
endif
// output zzz
  • 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-05-21T07:34:11+00:00Added an answer on May 21, 2026 at 7:34 am

    There are a variety of different comparison functions you can use, depending on how sophisticated you want to make your comparison. To find specifically a string that starts with “Pro Tan”, you could do:

    if (strpos($tanning, 'Pro Tan') === 0)
        echo 'xxx';
    

    Note the triple ===, since if strpos returns false, that’s not at all the same as returning 0.

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

Sidebar

Related Questions

How can I compare two values without if/else statement ? e.g var One =
I am trying to compare a string and a char like below : char
how can i compare multiple data using php for example i have a variable
Compare String.Format(Hello {0}, World); with Hello {0}.Format(World); Why did the .Net designers choose a
I would like to compare a screenshot of one application (could be a Web
I would like to compare the contents of a couple of collections in my
I want to compare the current value of an in-memory Hibernate entity with the
I have an oracle time interval in a select statement like this: SELECT ...
I saw below thing about switch statement in c++ standard $6.4.2. Switch statement can
I want to compare two times and if the new time is more than

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.