php not putting tables where I want them..
Posted: Mon Jan 19, 2004 3:51 am
Okay, I have a blog on my site and I am using a a type of templete and I have to blog file included on my main page.. Well, When I have more then one post it doesn't put the blog tables in the correct place.. I have included the blog's code in this post and here is the site that I am having the problem with..
http://www.o-blivion.com/
On my site I have commented on where the include function is so it will be easy to find.. Thanks for your help!!!
http://www.o-blivion.com/
Code: Select all
<?
//main page goes below
@include("/home/oblivion/public_html/site/blog/admin/config.php");
//search results
if(!empty($string)){
$string=explode(" ",$string);
$j=0;
$search_worde=Array();
for($i=0;$i<count($string);$i++) {
if($string[$i] != "") {
if(!ereg("^[+|-]",$string[$i])) {
$string[$i]="+".$string[$i];
}
$search_worde[$j]=$string[$i];
$j++;
}
}
$mysqlquery="select * from $tb_entries";
for($i=0;$i<count($search_worde);$i++) {
$search_word=substr($search_worde[$i],1);
if(ereg("^\+",$search_worde[$i])) {
if($i==0) $mysqlquery.="where entry LIKE '%$search_word%'";
else
$mysqlquery.=" AND entry LIKE '%$search_word%'";
}
else {
if($i==0) $mysqlquery.="where entry NOT LIKE '%$search_word%'";
else
$mysqlquery.=" AND entry NOT LIKE '%$search_word%'";
}
}
$user_query=mysql_query("SELECT * FROM $tb_user") or die(mysql_error());
while($array = mysql_fetch_array($user_query,MYSQL_ASSOC)) {
$user=$array["user"];
$$user=$array["email"];
}
$query=mysql_query($mysqlquery);
while($row = mysql_fetch_array($query)) {
$j = mysql_num_fields($query);
for($i=0;$i<$j;$i++) {
$k = mysql_field_name($query,$i);
$$k = $row[$k];
}
$entry=nl2br(stripslashes($entry));
if($foo!=$date){
//My title for blog entry for search Function
print("<table cellspacing="0" cellpadding="0" border=0><tr><td width="100" align="left" valign="top" style="padding: 5px"><span class="subjectheader"><img src="/site/images/bullet.gif" align="left"><i><b>$title</b></i></span><br><font size="1"><span class="timeheader"><i>$day, $date</i></span></font></td>");
$foo=$date;
}
//The Blog Entry For Search function
print("<td width="375" bgcolor=000000 align="left" valign="top" style="border-top: solid 1px #516382; border-bottom: solid 1px #516382; border-left: solid 1px #516382; border-right: solid 1px #516382; padding: 5px"><img src="/site/images/bullet.gif" align="left"><i>$entry</i><br><br><i>--$author</i></td></tr></table>");
$count=mysql_query("SELECT id FROM $tb_comments WHERE id = '$id'") or die(mysql_error());
$count=mysql_num_rows($count);
if($count=="0"){
$comment="Post Comment";
}
if($count=="1"){
$comment="1 Comment";
}
if($count>"1"){
$comment=$count." Comments";
}
$email=$$author;
print("<p align="right"><a href="/htm/blog/comments.php?id=$id">$comment</a></p>\n");
print("<br>");
print("<a href=/index.php><center>back</center></a>");
}
}
//end search results
//default view
else{
$user_query=mysql_query("SELECT * FROM $tb_user") or die(mysql_error());
while($array = mysql_fetch_array($user_query,MYSQL_ASSOC)) {
$user=$array["user"];
$$user=$array["email"];
}
$query=mysql_query("SELECT * FROM $tb_entries ORDER BY id DESC LIMIT $limit") or die(mysql_error());
while($row = mysql_fetch_array($query)) {
$j = mysql_num_fields($query);
for($i=0;$i<$j;$i++) {
$k = mysql_field_name($query,$i);
$$k = $row[$k];
}
$entry=nl2br(stripslashes($entry));
if($foo!=$date){
//Title For Blog Entry Main Page
print("<table cellspacing="0" cellpadding="0" border=0><tr><td width="100" align="left" valign="top" style="padding: 5px"><span class="subjectheader"><img src="/site/images/bullet.gif" align="left"><i><b>$title</b></i></span><br><font size="1"><span class="timeheader"><i>$day, $date</i></span></font></td>");
$foo=$date;
}
$email=$$author;
//Blog entry For Main Page
print("<td width="375" bgcolor=000000 align="left" valign="top" style="border-top: solid 1px #516382; border-bottom: solid 1px #516382; border-left: solid 1px #516382; border-right: solid 1px #516382; padding: 5px"><img src="/site/images/bullet.gif" align="left"><i>$entry</i><br><br><i>--$author</i></td></tr></table>");
$count=mysql_query("SELECT id FROM $tb_comments WHERE id = '$id'") or die(mysql_error());
$count=mysql_num_rows($count);
if($count=="0"){
$comment="Post Comment";
}
if($count=="1"){
$comment="1 Comment";
}
if($count>"1"){
$comment=$count." Comments";
}
print("<div align="right"><a href="/site/blog/comments.php?id=$id"><font size="1"><i>$comment</i></font></a></div><br>\n");
}
}
//end default view
?>