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
Delete records not in top 15
Hi,
I'm creating a hall of fame page in my game and the page will only display the top 15 sco
I think i'm using the syntax incorrectly
Hi Everyone!
I'm new to this forum and a newbie with PHP - I'm glad I found this site - I hop
this code is strange !
Hi i got this code from the web.. It checks for live and dead socks
It is working perfectly on my
Change log of Cost centre change in Plant maintenance order
Hi,
How to view Change log of Cost centre in Plant maintenance order. Not visible thru 'Docume
Change snippet to use CURDATE
I am using time() in the snippet below, I would like to use CURDATE() and have the database setup fo
Trouble with a select list
Hello All!
I was wondering if any of you guys could help me with a small problem I'm having!
How to get variable value on next page
Hello friends
i am working on payentry page ..there i have this code.........
Why is my row count 0?
Here's the MySQL query i'm running. It basically pulls data from 2 tables based on some data passed.
help need on ob_start()
Hi
I am a newbie in php, I have a code
Line number On/Off | Expand/Contract <?phpo
preg_replace question
Hello!!
I hope someone can help me with preg_replace.
I load two tables from an extern