Jump to content

Search the Community

Showing results for tags '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 4 results

  1. Hello, A not so experienced PHP-user here. For my school assignment, I have to make the following: "Stolwijkstraat 8" has to be shortened into SW with use of SUBSTR and STRTOUPPER. My question: 1. How can I be able to use SUBSTR and STRTOUPPER in the same line? 2. How can I be able to remove everything in the line ''Stolwijkstraat 8", on behalf of ''S'' and ''w''? A quick response would be greatly appreciated. Kind regards.
  2. Hello all, I have created a script that queries my MySQL database and gets a certain row, then echoes out: if(!$result = $db->query($sql)){ die('There was an error running the query [' . $db->error . ']'); } while($row = mysqli_fetch_array($result)) { echo "<li><a href=\"#\">"; echo $row['col_5']; echo "</li>"; } I would like to check to see if each of the row outputs has a string that is more than 13 characters, and if so, strip it down to 13 and add "..." to the end of the string. I did some research and added a line of code, but it still outputs the long string. Any ideas on where I went wrong? if(!$result = $db->query($sql)){ die('There was an error running the query [' . $db->error . ']'); } while($row = mysqli_fetch_array($result)) { $row = (strlen($row) > 13) ? substr($row,0,10).'...' : $row; // ADDED THIS LINE echo "<li><a href=\"#\">"; echo $row['col_5']; echo "</li>"; }
  3. Hi im trying to use the substr function in php. I have a string called $finalString and im trying to grab the last character of that string the line of code im using is : $startIndex = substr($finalString, -1); it wont work giving the error : Warning: substr() expects parameter 2 to be long, string given in /users/2017/bfm3/public_html/cs1109/lab10/markovnew.php on line 34
  4. Facebook Meta Tag - og:description for database value with strip_tags() and substr() $descpp = substr($fetchForumData[0]['descp'], 0, 300)."..."; // echo $descrp {As it shows correctly as the description data from database limit to 300 words via echo} <meta property="og:description" content="<?php echo strip_tags($descpp); ?>" /> The following script not working and shows result on facebook as '....' rather than '$descpp + .....' And I already debug via http://developers.facebook.com/tools/debug also. And for <meta property="og:description" content="<?php echo $fetchForumData[0]['descp']; ?>" />... its shows complete content on the top of the article page and after comment via facebook comment plugin it shows blank space on facebook timeline. What is missing? Kindly advice as soon as possible.
×
×
  • 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.