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 7718077
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T03:04:34+00:00 2026-06-01T03:04:34+00:00

I make this php program to access mysql data foreach ($arrayOfID as $ID) {

  • 0

I make this php program to access mysql data

foreach ($arrayOfID as $ID)     {
    $IDWhere[]="TB.ID LIKE '" .$ID."'";
    //$IDWhereOther[]="Business LIKE '".$ID."'";
    //  $IDWhereFinalOther1[]=$ID;
    $IDWherePhone[]="BusinessID LIKE '".$ID."'";
    //$IDWhereURLandImage[]="`Business ID` LIKE '".$ID."'";
    $newOutput[$ID]=array();
    $copy[$ID]=array(); 
    keyID2[]=$ID;
    $IDtoBuilding[]="TB.ID LIKE '".$ID."'";
}
IDWhereFinal=implode(" OR ", $IDWhere);
//$IDWhereFinalOther=implode(" OR ", $IDWhereOther);
//$IDFinalBuilding=implode(" OR ", $IDtoBuilding);  
//$query="Select *, Country FROM `tablebusiness` As TB, `tablecity` As TC WHERE (".$IDWhereFinal.") AND TB.City=TC.City";
//$query="Select *, Country, Building.Title FROM `tablebusiness` As TB, `tablecity` As TC, `tablebusiness` As Building WHERE (".$IDWhereFinal.") AND TB.City=TC.City And (Building.ID=TB.Building OR TB.Building=0)";
 //$query="Select *, Country, COALESCE(NULL,(select Title from `tablebusiness` As TBuild where  TBuild.ID=TB.Building)) as BuildingTitle FROM `tablebusiness` As TB,  `tablecity` As TC, `tablebusiness` As Building WHERE (".$IDWhereFinal.") AND TB.City=TC.City";
$query="Select *, Country, (select Title from `tablebusiness` As TBuild where TBuild.ID=TB.Building) as BuildingTitle FROM `tablebusiness` As TB, `tablecity` As TC WHERE TB.City=TC.City and (".$IDWhereFinal.")";
$data = mysql_query($query);

Problem is, sometimes $ID contains '

I think that should be escaped into ''

But ' may not be the only problem

Maybe there are other characters that should be encoded too.

Is there a function for that?

  • 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-01T03:04:35+00:00Added an answer on June 1, 2026 at 3:04 am

    Absolutely. You have to use mysql_real_escape_string. THat’s also good for security, basically you should put everytime you insert data in you DB (unless it’s not a string, then a cast to int/float/etc is OK)

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

Sidebar

Related Questions

How can I make something like this below work? <?PHP $_SESSION['signup_errors']['test1']; $_SESSION['signup_errors']['test2']; $_SESSION['signup_errors']['test3']; $_SESSION['signup_errors']['test4'];
i would like to learn how to make PHP/CSS syntax generator. i assume this
Ho to make this simple xml with php using DOM? Full code will be
In there an easy way to do this in PHP. I want to make
Every time in PHP when I make a variable such as this one: $date
I wanted to make a post request in this website: http://www.prezup.info/index.php?page=films in order to
now I can make it work with user-profile.tpl.php page,all this page does is to
I need rewrite this url http://adresa.com/article.php?act=view&id=1113 to http://adresa.com/view/1113 I make it with mod_rewrite in
After loading a PHP template (using jQuery's load function), this simple script won't make
I am writing a program that has to access a MySQL database. To do

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.