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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T09:05:35+00:00 2026-05-18T09:05:35+00:00

I used preg_split to remove the tag info from tweet message-id like, this is

  • 0

I used preg_split to remove the tag info from tweet message-id like, this is original output from Twitter

tag:search.twitter.com,2005:7551711354822656

I apply preg_split to get rid of ‘tag:search.twitter.com’ like

  $arr = preg_split("/,/", "strip_tags(mysql_real_escape_string($status->id))");
  $msg_ID =  $arr[1];

& insert $msg_ID[1] into table. Now I apply same to message-content whose twitter output is

  #DIYse_D  DELIVERAB: twitter messages 1, 9th OCT 2010

I apply preg_split to get rid of ‘twitter messages 1’ from it like

  $arr2 = preg_split("/,/", "strip_tags(mysql_real_escape_string($status->content))");
  $msg =  $arr[1];

& insert $msg[1] into table but it raises sql syntax error. OK, one thing here is that in $ status->id output, twitter added tag at the start of id while here it added ‘twitter messages 1’ inside the original message contents.
Here is SQL Insert Query

INSERT INTO msg2(id,msg,msg_id,depth,name) VALUES ('','$msg','$msg_ID','0','$name')
  • 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-18T09:05:35+00:00Added an answer on May 18, 2026 at 9:05 am
    $arr = preg_split("/,/", "strip_tags(mysql_real_escape_string($status->id))");
                             ^--here                                           ^--here
    $arr2 = preg_split("/,/", "strip_tags(mysql_real_escape_string($status->content))");
                               ^---here                                              ^---here
    

    The four double-quotes I’ve indicated turn those bits of “code” into literal text strings. You’re not trying to split the results of a strip_tags function call, you’re trying to split a string that says “strip_tags(etc…)”. Remove the double quotes so PHP will see that it’s a function call, and not a string.

    Since there’s no commas in that literal string, there won’t be any $arr2[1] value, so you’re trying to insert a blank (or a null) into the database.

    As well, change your function sequence to:

    mysql_real_escape_string(strip_tags(etc...))
    

    Escaping for database insert should be the LAST thing you do before inserting. It’s possible that strip_tags may change the ordering of the escapes and produce a ‘bad’ string, leaving you open to SQL injection attacks.

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

Sidebar

Related Questions

When used like this: import static com.showboy.Myclass; public class Anotherclass{} what's the difference between
Never used a cache like this before. The problem is that I want to
i used bellow code to search and find if http is includes in $url
Can you please help assemble a regex to be used in preg_split which will
I tried this: $mtcDatum = preg_match(/[0-9]{2}/[0-9]{2}/[0-9]{4}/, $lnURL); This returns an error message: Warning: preg_match()
Can anyone help me change this script to use preg_split (recommended substitute by php.net)
this is some form generation code. I would like to add a captcha or
I have used this pregmatch statement for validating email address preg_match(^[a-z0-9_\+-]+(\.[a-z0-9_\+-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*\.([a-z]{2,4})$^, $partner_email) If i
i want the content inside of the img tag from the string. for ex:-
preg_replace(array('#/(.?)#e', '/(^|_|-)+(.)/e'), array('::'.strtoupper('\\1'), strtoupper('\\2')), $text); I've never used regex this way,how does it work?

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.