Jump to content

Mixinf HTML with PHP


britt15

Recommended Posts

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]

[code]
<? 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")?>
[/code]
Link to comment
https://forums.phpfreaks.com/topic/5018-mixinf-html-with-php/
Share on other sites

Lots of options:

[code]

<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-->

[/code]

Just a few ways among many others.
Link to comment
https://forums.phpfreaks.com/topic/5018-mixinf-html-with-php/#findComment-17753
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.