Jump to content

[SOLVED] Problem


SkyRanger

Recommended Posts

Not sure why this isn't working,  It will bring up the info if there is a bid=whatever but when it doesn't have a bid it doesn't show anything.  here is what I have and you will see what I am trying todo:

 


$origdate = $postbdate->format('M d, Y  H:i');

    $bid = $row['bid'];
    $resulta = mysql_query( "SELECT * from board_post where bid='$bid'" ) or die( "Unable to select database");
                $wordnum = mysql_num_rows( $resulta );
while( $rowb = mysql_fetch_array( $resulta ) )
{

if ($rowb['bpid']) {
   echo $rowb['blfpost'];
   echo "<br>";
   echo $rowb['bpdate'];
} else {
#This section is not showing when bpid is empty or does not have a bid=$bid 
  echo "-------";
  echo "<br>";
  echo $origdate;
}
}
$origdate echos with no problem.

Link to comment
Share on other sites

is bpid same bid

 

 

Run this script and post o/p

while( $rowb = mysql_fetch_array( $resulta ) )
{



echo "<pre>";
print_r($rowb );




if ($rowb['bpid']) {
   echo $rowb['blfpost'];
   echo "<br>";
............
............

Link to comment
Share on other sites

is bpid same bid

 

 

Run this script and post o/p

while( $rowb = mysql_fetch_array( $resulta ) )
{

echo "<pre>";
print_r($rowb );

if ($rowb['bpid']) {
   echo $rowb['blfpost'];
   echo "<br>";
............
............

 

Table is empty so it will display nothing.

Link to comment
Share on other sites

if(mysql_num_rows($resulta)){

while( $rowb = mysql_fetch_array( $resulta ) )

{

 

if ($rowb['bpid']) {

   echo $rowb['blfpost'];

   echo "<br>";

   echo $rowb['bpdate'];

} else {

#This section is not showing when bpid is empty or does not have a bid=$bid

  echo "-------";

  echo "<br>";

  echo $origdate;

}

}

}else{

#This section is not showing when bpid is empty or does not have a bid=$bid

  echo "-------";

  echo "<br>";

  echo $origdate;

 

}

 

Link to comment
Share on other sites

Grrrr.....

 

if(mysql_num_rows($resulta)){
while( $rowb = mysql_fetch_array( $resulta ) )
{

if ($rowb['bpid']) {
   echo $rowb['blfpost'];
   echo "
";
   echo $rowb['bpdate'];
} else {
#This section is not showing when bpid is empty or does not have a bid=$bid
#  echo "-------";
#  echo " ";
  echo $origdate;
}
}}

 

This isn't working either.

 

I am not sure what the heck is going on.

Link to comment
Share on other sites

Ok, not sure if I explained it properly to what I am trying to do:

 

Table 1 (board)

bid

btitle

bmsg

bdate

etc....

 

Table 2 (board_post)

bpid

bid

blpost

bpdate

 

 

What I am trying to do is:

 

    $origdate = $postbdate->format('M d, Y  H:i')
    $bid = $row['bid'];

    $resulta = mysql_query( "SELECT * from board_post where bid='$bid'" ) or die( "Unable to select database");

                $wordnum = mysql_num_rows( $resulta );

while( $rowb = mysql_fetch_array( $resulta ) )
{
if ($rowb['bpid']) {
   echo $rowb['blfpost'];
   echo "<br>";
   echo $rowb['bpdate'];
} else {
  echo "-------";
  echo "<br>";
  echo $origdate;
}
}

This will display if the bid = $bid and bpid is there

echo $rowb['blfpost'];
   echo "<br>";
   echo $rowb['bpdate'];

But if there is no $bid it will not display the

echo "-------";
  echo "<br>";
  echo $origdate;

 

Link to comment
Share on other sites

taith if you see this post, thanks,  I just found my fix in another thread that was replied to by you.  Anybody else that is looking for help, best thing to do is keep searching the forum while you are still waiting for help, because you may end of finding the answer:

 

    $origdate = $postbdate->format('M d, Y  H:i');
    $bid = $row['bid'];

$sql = mysql_query("SELECT * FROM board_post where bid='$bid'");
if(mysql_num_rows($sql)==0){
echo "-----";
echo "<br>";
echo $origdate;
}else{
while($rowb = mysql_fetch_array($sql)) {
echo $rowb['blfpost'];
   echo "<br>";
   echo $rowb['bpdate'];
}
}

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.