can someone help me with the code?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
grudz
Forum Commoner
Posts: 68
Joined: Thu Dec 04, 2003 12:52 pm

can someone help me with the code?

Post 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
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Post 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);
grudz
Forum Commoner
Posts: 68
Joined: Thu Dec 04, 2003 12:52 pm

Post by grudz »

what is that code....i made my program screw up
grudz
Forum Commoner
Posts: 68
Joined: Thu Dec 04, 2003 12:52 pm

Post by grudz »

dont worry.....its fixed
no idea what happened
sorry
grudz
Forum Commoner
Posts: 68
Joined: Thu Dec 04, 2003 12:52 pm

Post by grudz »

however the code still shows me a row that doesnt have content inside the 'name' column
Post Reply