Jump to content

Search the Community

Showing results for tags 'trim'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 2 results

  1. Hi Guys, I have a search box on the site I am creating and when a user types their postcode in it the database is searched and members covering that location are shown. I have the following which works fine ... but: --------------------------------------------------------------------------------------------------------------- $postcode = mysqli_real_escape_string($myConnect, $_POST['searchbox']); #Convert the post code to upper case and trim the variable $postcode = strtoupper(trim($postcode)); #Remove any spaces $postcode = str_replace(" ","",$postcode); #Trim the last 3 characters off the end $postcode_wc = substr($postcode,0,strlen($postcode)-3); ------------------------------------------------------------------------------------- The problem i have is that if the user just types in the first part of the poscode such as SW1 it is then trimmed to zero characters or SW10 is trimmed to just S and this wont return the results! I need the last part of the code to only run if they enter 5 character or more! What should i add before or add to the last part of the code (shown in bold) Please Help! Thank you in advance kind souls!!!! Mark
  2. This is an example of my code: $status = $entry->title; echo substr(strstr($status," "), 1) . substr($status, 0, -18); Below is the outcome: I'm feeling cold in this room. #emotionalclothingPants: I'm feeling cold in this room. I want the oucome to look like this: I'm feeling cold in this room. Thus removing the "#emotionalclothing" part of the string How can this be achieved? Thanks Stuart
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.