473,324 Members | 2,400 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

How to show a litle contents of articles?

I have the script:

Expand|Select|Wrap|Line Numbers
  1. <h1>List Articles</h1>
  2. <?php
  3. // Conection to mysql
  4. require_once ('../connection/class.mysql.php');
  5. $data = new Mysql();
  6. $data->connect();
  7. // query SQL to read all the articles sorted according to its id
  8. $query = "SELECT * FROM newsdb ORDER BY newsid";
  9. $result = mysql_query($query);
  10. while ($data = mysql_fetch_array($result))
  11. {
  12.    // display titles of articles and little content of the articlel
  13.    echo "<h3><a href='view.php?newsid=".$data['newsid']."'>".$data['title']."</a></h3>";
  14.    if(!empty($data['pictures'])){
  15.    echo "<P><img align=left width=200px vspace=6 hspace=12 src='../images/".$data['pictures']."'></a>";} echo "<p align=justify>".$data['content']."</p>";
  16. }
  17. ?>
  18.  
From the script I have above, I want to show a litle content of the article. How? How script to I must add into the script above?
Mar 9 '10 #1
1 1085
dlite922
1,584 Expert 1GB
quick and dirty way to do it: sub_str()

Also take a look at str_word_count().

The manual is a very good source if information. Memorize it if you have to.



Dan
Mar 9 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

44
by: Mariusz Jedrzejewski | last post by:
Hi, I'll be very grateful if somebody can explain me why my Opera 7.23 (runing under linux) doesn't show me inner tables. Using below code I can see only "inner table 1". There is no problem with...
2
by: Mateo | last post by:
Hi! I have a litle JS problem.... I'm trying to make show/hide table JS function, but my show/hide table function works only on IE.... It works in mozilla partially. Actually,every time when I...
19
by: JezB | last post by:
I have a DIV whose contents varies in size according to data. How can I size the DIV precisely to fit it's contents ?
6
by: W.Guerlich | last post by:
I've got a Java servlet that delivers large database resultsets transformed to Excel with the HSSF library. In some cases it takes more than 15 minutes before transformation is done and content can...
4
by: Vonnie | last post by:
I have images stored in SQL (not paths or urls) I need to show them on webpages but the image control only seems to have a imageurl property. Is there another control I should use to databind? ...
3
by: Øyvind Isaksen | last post by:
Hi! I use a Repeater Control (with Item Template/Container.DataItem) to list all the articles in my different categories. The list displays "title", "ingress" and a "read more" link. This is...
4
by: bridgemanusa | last post by:
Hi All: I have a very long page of html that I want to take portions and hide them in divs, then show when a link is clicked. I have the hide show part working when the link is clicked, however...
4
by: Pieter | last post by:
Hi, Using VB.NET 2.0, Windows Forms. I want the ToolTip to be shown on every TextBox, ComboBox and DataGridView continuously, and show the contence of these controls. Is there a way to add the...
2
by: Neil99 | last post by:
I'm using a macro to transfer a table to txt file, which is fine but I want to run it each day (as the table contents change) and include the date in the filename without having to manually rename...
1
by: Jackmac | last post by:
Hi there, Hopefully an easy one for someone. I'm writing a small app (Visual Studio 2008) which will take an existing access database we have and show it in a form I'm writing. The fields have...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.