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
Undefined variables
hi
----------------------------------------------------------------------------------------------
Something like an INI editor or a DelimitedText-Editor
Hi all,
Am very, very, very new to PHP and not sure if I should be posting this to a Javascri
PHP Thumbnail Creation
Ok so i use this function to create thumbnails:
Code: function createthumb($name,$filename,$n
Optimize Code
Just started getting into the use of cookies. The following code will redirect users to a set URL s
Inserting multiple records from single form
I've found a number of threads that deal with this issue, but I'm new to php and coding language so
SQL query not working well
Hi,
I made a small table with 5 rows and want to make them an sql consult using rownum
Upload file!
Ok i have a form..
Code: <form name="form1" method="post" action=&quo
Undefined index: username HELP NEWBIE
I am trying a simple login/logout for my website. It works well with checking if the username exists
php global variable
how can we create global variable so we can use its value in any form.. Please give example to
user data not transferring to new page
I'm a PHP learner. After an index.php page, the user goes to a login.php page. Both pages seem to