Page 1 of 1

can someone help me with the code?

Posted: Fri Dec 05, 2003 3:22 pm
by grudz
i am not able to write php code yet, so can somebody help me out.......i want to basically say that if my column 'name' is null, then DONT show me the record.

Code: Select all

<?php

mysql_select_db($database_cnpa, $cnpa);
$query_forum = "SELECT * FROM forum ORDER BY `date` DESC";
$query_limit_forum = sprintf("%s LIMIT %d, %d", $query_forum, $startRow_forum, $maxRows_forum);
$forum = mysql_query($query_limit_forum, $cnpa) or die(mysql_error());
$row_forum = mysql_fetch_assoc($forum);

if (isset($HTTP_GET_VARS['totalRows_forum'])) {
  $totalRows_forum = $HTTP_GET_VARS['totalRows_forum'];
} else {
  $all_forum = mysql_query($query_forum);
  $totalRows_forum = mysql_num_rows($all_forum);
}


?>
i dont know if the "if statement" is the right one but i know that the $forum is the right table

Posted: Fri Dec 05, 2003 3:34 pm
by Weirdan

Code: Select all

mysql_select_db($database_cnpa, $cnpa);
$query_forum = "SELECT * FROM forum ORDER BY `date` DESC";
if (isset($HTTP_GET_VARS['totalRows_forum'])) {
   $totalRows_forum = $HTTP_GET_VARS['totalRows_forum'];
} else {
   $all_forum = mysql_query($query_forum);
   $totalRows_forum = mysql_num_rows($all_forum);
}
  $query_limit_forum = sprintf("%s LIMIT %d, %d", $query_forum, $startRow_forum, $maxRows_forum);
  $forum = mysql_query($query_limit_forum, $cnpa) or die(mysql_error());
  $row_forum = mysql_fetch_assoc($forum);

Posted: Fri Dec 05, 2003 3:42 pm
by grudz
what is that code....i made my program screw up

Posted: Fri Dec 05, 2003 3:48 pm
by grudz
dont worry.....its fixed
no idea what happened
sorry

Posted: Fri Dec 05, 2003 3:52 pm
by grudz
however the code still shows me a row that doesnt have content inside the 'name' column