want to add a break after a certain amount of characters
Posted on
16th Feb 2014 07:03 pm by
admin
i was wondering how to add a break in a blog post after a certain amount of characters... any idea on how to do this???
this is the code i'm workig with
Did you know?Explore Trending and Topic pages for more stories like this.
<?php
$connect = mysql_connect("localhost", "root", "") or die(mysql_error());
mysql_select_db("blog", $connect) or die(mysql_error());
echo "<h1>Blog</h1>";
$query = mysql_query("SELECT * FROM blog");
if (mysql_num_rows($query) == 0) {
echo "<hr />There are no posts yet, make the first in the admin section!";
} else {
while ($row = mysql_fetch_assoc($query)) {
echo "<hr />";
$title2 = $row['title'];
$name = $row['name'];
$email = $row['email'];
$post = $row['post'];
$date = $row['date'];
$time = $row['time'];
echo "<h3>Title: " . $title2 . "</h3><table width='100%'><tr><td><b>Posted by: " . $name . "(" . $email . ") at " . $time . " on " . $date . "</b></td></tr><tr><td>" . nl2br(strip_tags($post)) . "</td></tr></table>n";
}
}
echo "<hr />";
$page = $_GET['p'];
if ($page) {
$path = "/inc/" . $page . ".php";
if (file_exists($path)) {
include ($path);
}
}
echo "Are you an admin? <a href='index.php?p=blog&p=credentials'>Place a post</a>";
?>
No comments posted yet
Your Answer:
Login to answer
117
36
Other forums
Polymorphism
Was wondering if someone could explain this a little better to me. I had always assumed that it had
Cannot Connect to Database
I am writing an application to do annual reviews. I cannot get my script to work. Whenever it runs I
Problem with Sending Mail by PHP
hello all,
I m new to php, can u plz provide me the code to send mail by php having CAPTC
Restricted access to sub-folder in iis6 doesn't work?
Basically I'm trying to add restriction to sub-folder (which contains pdf) in web.config for iis6 as
user administration
Dear @all,
what I have to do to set the user defaults for new users. At the moment I woul
Need help making a script that moves data into acrhive table
Hi,
I'm kinda new to php/mysql
And i wrote a simple script to store sales lead for a b
Encrypt php code?
Is it possible to encrypt php code in files,
so that it displays a load of unreadable characters
how to get different value in second view of webdynpro?
hello guys,
In ABAP webdynpro I am trying to create one application having two views.
function to return url
Hi,
Can you guys help me giving a function that takes all the contents in a particular field
what are '%S%', '%E%'
for example when i see Code: [Select]printf("Hello %srn", $name);
what does %s means