Jump to content


Photo

Mixinf HTML with PHP


  • Please log in to reply
2 replies to this topic

#1 britt15

britt15
  • New Members
  • Pip
  • Newbie
  • 5 posts
  • LocationHawaii

Posted 15 March 2006 - 09:49 AM

I'm trying to make the title and date text in the following link bold. How do I do this? It is part of a blog script.

[a href=\"http://www.tainted-rose.com/blog/display.php\" target=\"_blank\"]http://www.tainted-rose.com/blog/display.php[/a]

<? include("http://www.tainted-rose.com/header.php")?>
<?php 
// Put database connection variables here 
$hostname="localhost"; 
$user="";    //user name to access database 
$pass= "";    //password     
$dbase="";    //database name 

$connection = mysql_connect("$hostname" , "$user" , "$pass") or die ("Cannot connect to MySQL"); 
$db = mysql_select_db($dbase , $connection) or die ("Cannot select database."); 

$q = "SELECT * from blog order by date desc "; 
$result= mysql_query($q, $connection) or die  
("Could not execute query : $q." . mysql_error()); 


// dynamic navigation variables 
$rows_per_page=1;         // adjust the number here to display number of entries per page  
$total_records=mysql_num_rows($result); 
$pages = ceil($total_records / $rows_per_page); 

$screen = $_GET["screen"]; 
if (!isset($screen)) 
$screen=0; 
$start = $screen * $rows_per_page; 
$q .= "LIMIT $start, $rows_per_page"; 
$result= mysql_query($q, $connection) or die  
("Could not execute query : $q." . mysql_error()); 


while ($row=mysql_fetch_array($result)) 
{ 
    $id=$row["id"]; 
    $name=$row["name"]; 
    $email=$row["email"]; 
    $entry=$row["entry"]; 
    $date=$row["date"]; 
    $icon=$row["icon"];  
    $title=$row["$title"]; 

?> 

    <table width="80%" border="0" cellspacing="1" cellpadding="0"> 
    <tr> 
    <td><?php echo "$title"; ?></td> 
    </tr> 
    <tr> 
    <td> 
    <p><img src="<?php echo "$icon"; ?>" alt="icon" align="center"><?php echo "$entry"; ?></p> 
    <p>Posted by <a href="mailto:<?php echo "$email"; ?>"><?php echo "$name"; ?> on <?php echo "$date"; ?>.</p> 
    </td> 
    </tr> 
    </table> 
    <p align="right"> 
     
    <?php 
     
    $query = "select id from blog_comments where blog_id='$id' "; 
    $ret = mysql_query($query) or die (mysql_error()); 
    $comment_num = mysql_num_rows($ret); 
     
    // display number of comments 
    echo "<a href=\"http://www.tainted-rose.com/blog/readcomments.php?id=$id\">$comment_num</a>"; 
     
    ?> 
     
    </p> 
    <?php 
} #while 
?> 
<div align=center> 

<?php 

// Display dynamic navigation here 

// create the dynamic links 
if ($screen > 0) { 
$j = $screen - 1; 
$url = "display.php?screen=$j"; 
echo "<a href=\"$url\">Prev</a>"; 
} 

// page numbering links now 

for ($i = 0; $i < $pages; $i++) { 
$url = "display.php?screen=" . $i; 
$j = $i + 1; 
echo " | <a href=\"$url\">$j</a> | "; 
} 

if ($screen < $pages-1) { 
$j = $screen + 1; 
$url = "display.php?screen=$j"; 
echo "<a href=\"$url\">Next</a>"; 
} 

?> 

</div> 
<? include("http://www.tainted-rose.com/footer.php")?>

Life is not known, it is experianced.

#2 lessthanthree

lessthanthree
  • Members
  • PipPipPip
  • Advanced Member
  • 85 posts
  • LocationUK

Posted 15 March 2006 - 09:55 AM

Lots of options:


<td><b><?php echo $title; ?></b></td>

<td style='font-weight:bold;'><?php echo $title; ?></td>

<td class='bold'><?php echo $title; ?></td> <!--obviously you would need a css class for this one-->


Just a few ways among many others.
call me a safe bet, i'm betting i'm not

#3 britt15

britt15
  • New Members
  • Pip
  • Newbie
  • 5 posts
  • LocationHawaii

Posted 15 March 2006 - 10:11 AM

Didn't work. I used your second bit of code.
Life is not known, it is experianced.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users