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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T21:08:27+00:00 2026-05-17T21:08:27+00:00

I am trying to move a old Classic ASP site to run in PHP.

  • 0

I am trying to move a old Classic ASP site to run in PHP. I am rewriting bits of it, however I have come across the following function that is causing me some problems. Basically the function FixForSQL is run on everything before adding it to the database and then FixForHTML is run on data returned with a SQL query to format it for display.

At the moment if I display a block of text retrieved from the database in PHP it shows as one huge block of text with no paragraph breaks, I presume because I haven’t done the replace of Chr(13) and whatever Chr(9) is!

Does anyone know how to reproduce whatever is happening in PHP 5?

 Function FixForHTML(tmpText1)
    Dim tmpText2
    tmpText2 = tmpText1
    tmpText2 = Replace(tmpText2,Chr(13),"</p><p>" & vbCrLf)
    tmpText2 = Replace(tmpText2,Chr(9),"&#xa0;&#xa0;&#xa0;&#xa0;")
    FixForHTML = tmpText2
 End Function

 Function FixForSQL(tmpText1)
    Dim tmpText2
    tmpText2 = tmpText1
    tmpText2 = Replace(tmpText1,vbCrLf,Chr(13))
    tmpText2 = Replace(tmpText2,Chr(39),String(2,39))
    FixForSQL = tmpText2
 End Function
  • 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-17T21:08:28+00:00Added an answer on May 17, 2026 at 9:08 pm

    Chr(13) is the the character whose ASCII code is 13. You can get it in PHP with, you guessed, chr(13).

    13 is the code for Cariage return. While 9 is for Horizontal tab. In PHP you can also get those characters in a parsable string (one delimited by "s) with \n, respectively \t.

    ASCII table

    Sample code for PHP:

    $text = str_replace(array("\n", "\r"), array("</p><p>", "&#xa0;&#xa0;&#xa0;&#xa0;"), $text);
    

    As for the FixForSQL function, it just replaces ' characters with '' to escape them for the SQL query.

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

Sidebar

Related Questions

I'm trying to move and old JSF v1.0 application from Sun One to Jboss
I'm trying to move a project from an old linux platform to a kubunutu
I'm trying to move a java application from an old server to a new
I'm trying to move a working copy folder from it's old dedicated svn server,
I'm trying to move our project over to VS2008 from VS2005 and am running
I am trying to move a WordPress installation from one server to another one,
I'm working with some old code (and frankly I don't know half of what
I am using eclipse / subclipse for development. I also have the TortoiseSVN client.
In mixing and matching older tutorials with recent posts on MVC 3 Preview 1,
I had a Drupal installation at www.example.com/test . Now, it's ready to go live,

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.