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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:47:56+00:00 2026-05-27T06:47:56+00:00

I am storing text in my database. Here is the following text: .$teamName., is

  • 0

I am storing text in my database.
Here is the following text:

".$teamName.", is the name of a recently formed company hoping to take over the lucrative hairdryer design ".$sector."

After querying the database I assign this text to a variable called $news, then echo it.

However the text is outputted to the screen exactly as above without the variables $teamName*and $sector replaced by there corresponding values.

I assure you that both $teamName and $sector are defined before I query the database.

Is it even possible to do what I am trying to do?

  • 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-27T06:47:57+00:00Added an answer on May 27, 2026 at 6:47 am

    You might be better off using sprintf() here.

    $string = "%s is the name of a recently formed company hoping to take over the lucrative hairdryer design %s.";
    
    $teamName = "My Company";
    $sector = "sector";
    
    echo sprintf($string, $teamName, $sector);
    // My Company is the name of a recently formed company hoping to take over the lucrative hairdryer design sector.
    

    In your database, you store $string. Use sprintf() to substitute the variable values.

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

Sidebar

Related Questions

Following code is an example of text placed into a textarea from a database.
I am using the following query to take backup with backup file name as
I have following text in SQLITE database in TEXT field The exact date of
I want to compare an string which is in clear text in the database
I have a text file which I am reading and storing the data in
I am storing a list of numbers (as Double) in a text file, then
I'm using CF8 and SQL2000. I'm storing a bunch of HTML in a Text
I have the following entity (getters and setters ommited)... @Entity @Table(name = TBL_PROJECT_RUN) public
I have the following class Person: public class Person { public string Name {
I have to store hindi text in a MySQL database, fetch it using a

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.