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

<?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 Like 36 Dislike
Previous forums Next forums
Other forums

Print out contents of to Excel
I have got this script that gathers all the data that I need but I need it to send it to excel inste

Session variable help
I'm having a very troubling issue. Maybe I'm just looking over something but I have looked at the co

Losing 'page' data
I have this code that allows me to update my database. But after updating, I lose the $_GET['page']

try catch error
I have been trying try catch but, I can't get it to work. The code opens a non existing file called

Do not allow posting of whitespace
Currently the script below works if the user does not type a name/message, but if i create a whitesp

button help
i originally had this but realised it is much easier to have a button.

Code: <?php

Problems with array
This code is the last lines in an upload script that uploads 4 images at the same time and writes th

How to get the previous months last date....
Here's my wittle problem. I suck at working with dates.

So today is 10/20/2009, i need to fig

php not working written for consumption of slots
1. Here is the function where i will be allowed to consume the slot booked by me.

2. Here i c

Limiting checkboxes?
Hi guys,

I have this code: Code: if(isset($_POST['selected'])) {
foreach($_POST['selec

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash