Jump to content

Search the Community

Showing results for tags 'php substr()'.

  • 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 1 result

  1. Hello all. I have a sports league database where when a team registers as a “returning team” from last year, it queries a table that contains the basic information from last year’s team names, league, night and division. Simple enough. However I would like to do two things to the data in the array. First, I want to take two fields ‘firstname’ and ‘lastname’ and create an output that lists only the first character of the ‘firstname’, add a dot, then the ‘lastname’ i.e. J. Doe as the output. Second, I want to limit the number of characters in the ‘teamname’ field to no more than 25 characters, and if it’s over 25 characters, limit the output to 25 characters then 3 dots ‘…’ For example if the teamname was “Twenty Five Crazy Characters Team” it would be cut to “Twenty Five Crazy Charact…” to limit the size of the field I am using. I basically only have 5 strings I am working with. “season” “league” “teamname” and “firstname” and of course “lastname”. I am simply having the hardest time manipulating the array data to output as I have written above. I have hit a wall here. Was hoping some type of substr() statement would help, but alas it is not working. PHP coders, I NEED YOUR HELP! Thanks in advance! <select name="ret_teamname" id="ret_teamname" tabindex="4" > <option value="" selected="selected">-- Select Returning Team --</option> <?php while ($lrow = mssqlfetchassoc($rres)) { ?> <option value="<?php echo $lrow['l_id'];?>"><?php echo "$lrow[season] $lrow[leaguename] $lrow[rteamname] $lrow[firstname] $lrow[lastname]"; ?></option> <?php } ?> </select>
×
×
  • 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.