| PHP, MySQL General PHP questions. Or go to our PHPsuexec Forum >> |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread |
|
|
#1 (permalink) |
|
DemonicAngel
Super #1
Joined in Aug 2004
Lives in Wherever The World Takes Me
Hosted on Pass76
1,841 posts
Gave thanks: 27
Thanked 35 times
|
Posts not showing
the posts aren't showing...
(i tink i posted earlier in the wrong forum... sorry please have mercy) but yeah... here's the code: Code:
</td></tr>
<tr><td colspan=5 class="tblhd">
<?php
$df = mysql_db_query($db,"SELECT * FROM mbforum WHERE id='$f'");
while($dsf=mysql_fetch_array($df)){
echo"<a href=\"index.php\">$brnm</a>~>$dsf[forum]";
}
?>
</td></tr>
<tr>
<td colspan=5>
<?php
if($user!=""){
if($skin==""){
echo"<a href=\"index.php?mode=new&f=$f&ty=new\"><img src=\"new.gif\" alt=\"New Post\" align=\"right\"></a>";
}else{
echo"<a href=\"index.php?mode=new&f=$f&ty=new\"><img src=\"$skin/new.gif\" alt=\"New Post\" align=\"right\"></a>";
}
}else{
echo"<a href=\"index.php?mode=login\"><img src=\"new.gif\" alt=\"Login\" align=\"right\"></a>";
}
?></td></tr>
<tr><td colspan=5 class="tblhd"><b>Sticky Important Posts</b></td></tr>
<?php
$ds = "SELECT * FROM mbposts WHERE forum='$f' AND type='stick' ORDER BY cid DESC";
$shtw = mysql_db_query($db,$ds);
while($dp=mysql_fetch_array($shtw)){
$topic = "$dp[topic]";
$check = strpos($dis,"$dp[id]");
if(!$check){
$dis.=" $dp[id] ";
$did = "SELECT * FROM mbposts WHERE id='$dp[id]' ORDER BY cid DESC LIMIT 1";
$shown = mysql_db_query($db,$did);
while($d2=mysql_fetch_array($shown)){
echo"<tr><td width=5%><center>";
$dispic = mysql_db_query($db,"SELECT * FROM mbread WHERE who='$user' AND topic='$topic' AND forum='$f'");
while($dpc=mysql_fetch_array($dispic)){
$new="no";
}
if($new=="no"){
if($skin==""){
echo"<img src=\"no.png\">";
}else{
echo"<img src=\"$skin=/no.png\">";
}
}else{
if($skin==""){
echo"<img src=\"new.png\">";
}else{
echo"<img src=\"$skin/new.png\">";
}
}
$topic = str_replace("\'","'",$d2[topic]);
$topic = str_replace("'","'",$topic);
echo"</center></td><td width=35%><a href=\"index.php?mode=topic&topic=$d2[id]&f=$f\">$topic</a></td>";
$dps = mysql_db_query($db,"SELECT * FROM mbposts WHERE forum='$f' AND id='$dr[id]'");
$dp = mysql_num_rows($dps);
if($dp<2){
$rr = $dp;
}else{
$rr = $dp-1;
}
echo"<td width=20%>Replies: $rr</td>";
echo"<td width=20%>Last: $d2[who]</td><td width=20%>On: $d2[date]</td></tr>";
}
}
}
?>
<tr><td colspan=5 class="tblhd"><b>Posts</b></td></tr>
<?php
$do = "SELECT topic FROM mbposts WHERE forum='$f' AND type!='stick' ORDER BY cid DESC ";
$show = mysql_db_query($db,$do);
$show2 = mysql_db_query($db,$do);
$rows_per_page=20;
$total_records=mysql_num_rows($show);
$pages = ceil($total_records / $rows_per_page);
mysql_free_result($show);
if (!isset($screen))
$screen=0;
$start = $screen * $rows_per_page;
$do.="LIMIT $start, $rows_per_page";
$show = mysql_db_query($db,$do) or die ("Could not execute query : $q." . mysql_error());
echo"<tr><td colspan=5 class=\"tblhd\">";
if ($screen > 0) {
$j = $screen - 1;
$url = "index.php?mode=forum&screen=$j&f=$f";
echo "<a href=\"$url\"><<</a>";
}
// page numbering links now
for ($i = 0; $i < $pages; $i++) {
$url = "index.php?mode=forum&f=$f&screen=$i";
$j = $i + 1;
if($i==$screen){
echo"|$j|";
}else{
echo " | <a href=\"$url\">$j</a> | ";
}
}
if ($screen < $pages-1) {
$j = $screen + 1;
$url = "index.php?mode=forum&screen=$j&f=$f";
echo "<a href=\"$url\">>></a>";
}
echo"</td></tr>";
while($dr=mysql_fetch_array($show2)){
$topic = "$dr[topic]";
$check = strrpos($dis,"$topic$dr[id]");
if(!$check){
$dis.=" $topic$dr[id] ";
$did = "SELECT * FROM mbposts WHERE id='$dr[id]' ORDER BY cid DESC LIMIT 1";
$shown = mysql_db_query($db,$did);
while($d2=mysql_fetch_array($shown)){
echo"<tr><td width=5%><center>";
$dispic = mysql_db_query($db,"SELECT * FROM mbread WHERE who='$user' AND id='$dr[id]'");
while($dpc=mysql_fetch_array($dispic)){
$new="no";
}
if($new=="no"){
if($skin==""){
echo"<img src=\"no.png\">";
}else{
echo"<img src=\"$skin=/no.png\">";
}
}else{
if($skin==""){
echo"<img src=\"new.png\">";
}else{
echo"<img src=\"$skin/new.png\">";
}
}
$topic = str_replace("\'","'",$d2[topic]);
$topic = str_replace("'","'",$topic);
echo"</center></td><td width=35%><a href=\"index.php?mode=topic&topic=$topic&f=$f\">$topic</a></td>";
$dps = mysql_db_query($db,"SELECT * FROM mbposts WHERE forum='$f' AND id='$dr[id]'");
$dp = mysql_num_rows($dps);
if($dp<2){
$rr = $dp;
}else{
$rr = $dp-1;
}
echo"<td width=20%>Replies: $rr</td>";
echo"<td width=20%>Last: $d2[who]</td><td width=20%>On: $d2[date]</td></tr>";
}
}
}
?>
<td>
no :'( but anyways, it's suppose to display the posts made... here's the table in mysql: CREATE TABLE mbposts( forum text NOT NULL, post text NOT NULL, type varchar(50) NOT NULL, type2 varchar(50) NOT NULL, who varchar(50) NOT NULL, topic text NOT NULL, date varchar(200) NOT NULL, id int(100) NOT NULL, cid int(100) NOT NULL auto_increment, PRIMARY KEY (cid) ); |
|
|
|
|
|
#2 (permalink) |
|
the one who was
Super #1
Joined in Jul 2003
Lives in Memphis
1,967 posts
Gave thanks: 0
Thanked 3 times
|
This could be any number of things, and the code itself won't help a lot. The easiest way to start troubleshooting this is to start echoing the queries being done. I believe chances are high something in the queries is causing zero results to be returned, which would result in no posts being displayed.
Once you echo the queries, then cut-n-paste them into phpMyAdmin for this database and see what it returns. If it returns results, then it is in the code itself. If it doesn't return results, then you have a problem with the queries themselves.
__________________
Patrick Warnings: The program(s) might crash unexpectedly or behave otherwise strangely. (But of course, so do many commercial programs on Windows.) --www.gimp.org |
|
|
|