473,583 Members | 3,460 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to display first record in bold

Hello,

I'm pulling news titles from MySQL. How Can I display first record in
bold (different than other ones). What is the best way to do that. Is
there some 'magic' query or PHP function.

*First Headline*
Second Headline
Third Headline

TNX

Jul 17 '05 #1
4 9310
dr. zoidberg wrote:
Hello,

I'm pulling news titles from MySQL. How Can I display first record in
bold (different than other ones). What is the best way to do that. Is
there some 'magic' query or PHP function.

*First Headline*
Second Headline
Third Headline

TNX


I would look into mysql_num_rows == 1 ... if your select statement is made
orderly.
If the value is one, then print in bold ... else don't.

/Andreas
--
Registeret Linux user #292411
Jul 17 '05 #2
On Sat, 15 Nov 2003 01:28:27 +0100, "dr. zoidberg" <so*****@exampl e.wrong>
wrote:
I'm pulling news titles from MySQL. How Can I display first record in
bold (different than other ones). What is the best way to do that. Is
there some 'magic' query or PHP function.

*First Headline*
Second Headline
Third Headline


Just use a simple flag.

$first = true;
while ($row = mysql_fetch_arr ay()) {
if ($first) {
// bold
$first = false;
} else {
// normal
}
}

--
Andy Hassall (an**@andyh.co. uk) icq(5747695) (http://www.andyh.co.uk)
Space: disk usage analysis tool (http://www.andyhsoftware.co.uk/space)
Jul 17 '05 #3
I noticed that Message-ID: <4h************ *************** *****@4ax.com>
from Andy Hassall contained the following:
Just use a simple flag.

$first = true;
while ($row = mysql_fetch_arr ay()) {
if ($first) {
// bold
$first = false;
} else {
// normal
}
}

Calling the function does that automatically

$row = mysql_fetch_arr ay()
//print the row in bold
while ($row = mysql_fetch_arr ay()) {
//print the other rows normally
}

--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Jul 17 '05 #4
Andreas Paasch wrote:
dr. zoidberg wrote:
Hello,

I'm pulling news titles from MySQL. How Can I display first record
in
bold (different than other ones). What is the best way to do that.
Is
there some 'magic' query or PHP function.

*First Headline*
Second Headline
Third Headline

TNX

I would look into mysql_num_rows == 1 ... if your select statement is
made
orderly.
If the value is one, then print in bold ... else don't. /Andreas

As far as I know there is no single SQL line that can solve your problem.
you need to check the pointer location, and the best way will be something
like this:

$query_headline = mysql_query ("SELECT headline FROM headlines") or die
("Query failed!");
$first_row = true;
while ($row=mysql_fet ch_array($query _headline)){
if ($first_row)
{
echo "<b>".$row['topicName']."</b><br />";
$first_row = false;
} else
{
echo $row['topicName']."<br />";
}
}

Hope it helps...

##-----------------------------------------------#
Article posted from PHP Freaks NewsGroup
http://www.phpfreaks.com/newsgroup
Get Addicted: comp.lang.ph
##-----------------------------------------------##
Jul 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
2741
by: Oliver | last post by:
Hello, i'm having trouble with a css type popup. It's not doing what i want in Mozilla 1.6 and in IE6.0 it's not working at all. The html code looks like this: <div class="themenkueche" id="tk"> <h1>Themenk&uuml;chen</h1> <p>
4
4143
by: DBQueen | last post by:
I have a subform which is in Continuous Forms view. I have added a button to the bottom of the page to move to the next record using the button wizard (result: DoCmd.GoToRecord , , acNext). I want all of the controls in whatever is the CURRENT record to have it's data bolded on the screen. (Question #1: Is there a SIMPLE way to refer to...
2
3347
by: ruby_bestcoder | last post by:
Hi Im having problem in firefox with display:none/block. I have essentially 3 li elements. In each element there are a few nested div:s. Clicking on one of the divs, makes another div to display: block or none. Again this works in IE. In ff it has a bug. When the display is none for a div in the first li, then the next li (the one...
2
2518
by: magix | last post by:
Hi, I'm using Access Database with ASP. There is one particular thing that I have issue with. My purpose is for user to update their own profile. Their existing profile information will be display in Edit Form format. The problem is if the field has space, the second word will not display, when I display in input text format. E.g if My...
5
1967
by: CES | last post by:
All, I was hoping that someone might be able to help me with a few questions on Aligning Block Elements properly... Basically I have a row that has a fixed width of 900px. Within the row their is a <Divthat I want to align to the Right hand side of the <Div id=” Container “>. That div <Div id=”items”needs to be able to expand and contract...
3
4925
by: Jannette | last post by:
I've got this to finally work in IE (its only taken me 2 days solid), but now mozilla isn't displaying the text on the same line as the image. I'm a newby at CSS, and I've think I've worked on trying to resolve this too long and now I'm totally lost. I've posted this up to a site: *************************Uploaded to SERVER...
0
4923
by: adamselearning | last post by:
I have HTML content defined in an external XML file: I am using code to identify when a <p> tag is present, so it is not treated as an XML node. I'm also using CDATA in some cases, and still have the same problem then (even worse) with letter-spacing. ... and here's a screenshot of the text rendered on screen from the HTML above: ...
2
3254
by: wreed06 | last post by:
Hello, I have 2 problems. In my webpage, I have a dropdown list with a button that takes the user to a popup window specific to the option. I am using Firefox 2.0.0.13. I have successfully validated my HTML and CSS code. 1. When I clear cache and refresh my webpage, it takes 3 tries before the popup window displays - I click on the button...
3
1548
by: Zaur Bahramov | last post by:
Hi! I'm developing a web application where the first page shows table from SQL Server and has some hyperlinks in one collumn. The collumn has productID so when clicked the page is passed as defpost.aspx?id={0} When user clicks on a hyperlink it is redirected to defpost.aspx page where basing on the value of ID the data grid needs to...
0
7893
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7821
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8172
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8317
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
6574
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5369
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
2326
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1422
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1151
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.