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

Need help with PHP/MySQL drop down menu
I need help on how I can implement a drop down menu which queries mysql database and output the avai

When i am Canseling the Billing Document in VF11 I am getting Shortdump
Hi Experts

When i am Canseling the Billing Document in VF11 I am getting Shortdump.

Multi dimensional arrays
If I put in this code:

1
2
3
4
5
6
7
8
9
10
11
12
13<

standard ALV application toolbar, into custom report....
HI,

I have a question regarding displaying standard ALV menu path and application toolbar

Help on code output
My CODE:

Code: [Select] echo "<phone>".$line["phone"].&qu

Creation of Raw Exposure manually
SAP Gurus

I am creating Raw Exposure ( Hedge management ) thru T Code TEM10 with followin

Pro-rata Billing in Periodic Billing for Rental
Hi guys,

We have a situation, where a rental contract starts at the mid of the month say

Multi-image upload problems
Lets see if I can get some help on this one. Can anyone show me what I am doing wrong here. I'm just

Php - mysql store data and use it later?
Hi, i' making a login page at the moment, however my username + password is stored many different pl

Saving PHP output as a file
I wondered if anyone knows how to save the rendered output of a PHP script as a file?

I have

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