Jump to content

[SOLVED] form does not show?


darkfreaks

Recommended Posts

Here's my take on your code. Please note the two lines I commented out and the comments/questions I entered on the line.

 

<?php
$strTitle = "Complaints/Reports";
define('QUADODO_IN_SYSTEM', true);
require_once('includes/header2.php');
$qls->Security->check_auth_page('complaints.php');
$tmp = array();
$tmp[] = '<h2>Complaints/Reports</h2>';
$tmp[] = '<form name="action" id="action" method="post" action="commentsdelete.php">';

include ('config.php');
// $query=trim(mysql_real_escape_string($query));   <-- What's this?
$query = "SELECT * FROM vc_comments WHERE username='admin' ORDER BY `id` DESC LIMIT 0,9";
$result = mysql_query($query) or die("Problem with the query: $query<br>" . mysql_error());

// mysql_close(); <-- not needed, infact probably shouldn't be here at all
if (mysql_num_rows > 0)
   while ($rw = mysql_fetch_assoc($result)) {
        $tmp[] = '<table border="0" width="100%" cellpadding="0" cellspacing="0" class="table">';
        $tmp[] = '<tr>';
        $tmp[] = '<td width="20"><input type="checkbox" id="' . $rw['id'] . '" value="' . $rw['id'] .'" name="' . $rw['id'] . '"></td>';
        $tmp[] = '<td width="30%" align="center">';
        $tmp[] = '<a href="../profile/' . $rw['from'] . '">' . $rw['from'] . '</a><br>' . $rw['date'] . '<br>';
        $tmp[] = '<a href="commentsadd.php?u=' . $rw['from'] . '">[ Reply ]</a>';
        $tmp[] = '</td>';
        $tmp[] = '<td width="70%">';
        $tmp[] = $rw['message'];
        $tmp[] = '</td></tr></table>';
        $tmp[] = '<p>';
   }

$tmp[] = '<input type="submit" name="delete" id="delete" value="Delete Comments">';
$tmp[] = '</form>';
echo implode("\n",$tmp)."\n";
include ('includes/footer.php');
?>

 

Ken

If the form isn't showing, then there are no rows being fetched. Put in an echo statement to show the number of rows fetched:

<?php
$strTitle = "Complaints/Reports";
define('QUADODO_IN_SYSTEM', true);
require_once('includes/header2.php');
$qls->Security->check_auth_page('complaints.php');
$tmp = array();
$tmp[] = '<h2>Complaints/Reports</h2>';
$tmp[] = '<form name="action" id="action" method="post" action="commentsdelete.php">';

include ('config.php');
$query = "SELECT * FROM vc_comments WHERE username='admin' ORDER BY `id` DESC LIMIT 0,9";
$result = mysql_query($query) or die("Problem with the query: $query<br>" . mysql_error());
echo 'Number of rows fetched = ' . mysql_num_rows($result) . "<br>\n"; // <-- insert this statement
if (mysql_num_rows($result) > 0) {
   while ($rw = mysql_fetch_assoc($result)) {
        $tmp[] = '<table border="0" width="100%" cellpadding="0" cellspacing="0" class="table">';
        $tmp[] = '<tr>';
        $tmp[] = '<td width="20"><input type="checkbox" id="' . $rw['id'] . '" value="' . $rw['id'] .'" name="' . $rw['id'] . '"></td>';
        $tmp[] = '<td width="30%" align="center">';
        $tmp[] = '<a href="../profile/' . $rw['from'] . '">' . $rw['from'] . '</a><br>' . $rw['date'] . '<br>';
        $tmp[] = '<a href="commentsadd.php?u=' . $rw['from'] . '">[ Reply ]</a>';
        $tmp[] = '</td>';
        $tmp[] = '<td width="70%">';
        $tmp[] = $rw['message'];
        $tmp[] = '</td></tr></table>';
        $tmp[] = '<p>';
   }
   $tmp[] = '<input type="submit" name="delete" id="delete" value="Delete Comments">';
}
$tmp[] = '</form>';
echo implode("\n",$tmp)."\n";
include ('includes/footer.php');
?>

 

Ken

I don' t know. You have to check your query

SELECT * FROM vc_comments WHERE username='admin' ORDER BY `id` DESC LIMIT 0,9

manually against your database. If you have phpmyadmin, use that. Without access to your database, we can't help you.

 

Ken

okay can someone tell me why the following code works on another page? and fetches rows but does not on my current code?

 

 

<?php
$strTitle = "Your Comments";
define('QUADODO_IN_SYSTEM', true);
require_once('includes/header2.php');
$qls->Security->check_auth_page('comments.php');

$logname = stripslashes($qls->user_info['username']);

echo "Recieved Comments | <a href=\"commentssent.php\">Sent Comments</a> | somthing else soon
<h2>Your Comments</h2>
<form name=\"action\" id=\"action\" method=\"post\" action=\"commentsdelete.php\">
";

include ('config.php');
$query=trim(mysql_real_escape_string($query));
$query = "SELECT * FROM vc_comments WHERE username='$logname' AND inbox='' ORDER BY `id` DESC LIMIT 0,9";
$result = mysql_query($query);

$num=mysql_num_rows($result) or die(mysql_error());

$i=0;
for ($i = 0; $i < $num; $i++) {

$id = mysql_result($result,$i,"id");
$from = mysql_result($result,$i,"fname");
$date = mysql_result($result,$i,"date");
$dpic = mysql_result($result,$i,"dpic");
$message = mysql_result($result,$i,"message");
{
echo "<table border=\"0\" width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" class=\"table\">
<tr>
<td width=\"20\"><input type=\"checkbox\" id=\"$id\" value=\"$id\" name=\"$id\"></td>
<td width=\"30%\" align=\"center\">
<a href=\"../profile/$from\">";
if (empty($dpic)) {
echo "";
}else{
echo "<img src='gallery/$dpic' border='0' class='thumbnail2'>";
};
echo "<br>$from</a><br>";

$users = $qls->online_users();
$online_count = count($users);
$online = false;

for ($x = 0; $x < $online_count; $x++) {
  if ($users[$x]['username'] == $from) {
  $online = true;
  break;
  }
}

if ($online === true) {
echo "<font color='Lime'>[Online]</font>";
}
else {
echo "<font color='Red'>[Offline]</font>";
}
echo "<br>$date<br>
<a href=\"commentsadd.php?u=$from\">[ Reply ]</a>
</td>
<td width=\"70%\">
$message
</td></tr></table>
<hr>";
};

};
mysql_close();
echo "<input type=\"submit\" name=\"delete\" id=\"delete\" value=\"Delete Comments\">
</form>";

include ('makecommentsold.php');

include ('includes/footer.php');
?>

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.