Jump to content

Caesar

Members
  • Posts

    1,025
  • Joined

  • Last visited

    Never

Posts posted by Caesar

  1. If you're using double quotes, you can't do this...

     

    <?php
    
      echo"This is not "correct" when you have double quotes";
    
    ?>

     

    This is the correct way to do it...

     

    <?php
    
      echo"This is not \"correct\" when you have double quotes";
      //You need to escape double quotes - Same rule applies when using single quotes
    
    ?>

  2. Anyway, if I'm seeing this right...your loop is wrong. $rowTotJoyCard isn't an array. You can't loop it.

     

    P.S....print out the $rowTotJoyCard and see what it outputs before your loop.

     

    <?php
    
      $NewJoyCard = mysql_query("SELECT count(*) FROM subscribers WHERE formid = 4 and DATE(FROM_UNIXTIME(requestdate)) = CURRENT_DATE()");
    
      print('<pre>');
      print_r($rowTotJoyCard);
      print('</pre>');
    
    ?>
    

     

     

     

     

  3. The page isn't right.

     

    <?
    
    $NewJoyCard = mysql_query("SELECT count(*) FROM subscribers WHERE formid = 4 and DATE(FROM_UNIXTIME(requestdate)) = CURRENT_DATE()");
    
    
    php  foreach($rowTotJoyCard as $field){ 
    					 if($field >0){?> <a href="javascript:popUp('details2.php?MR=TotJoyCard&Reg=Total Joy Card Signups&Tot=$field')"><?php echo $field; ?></a><?php }
    						 else{echo "0";}
    					}  ?>

     

    What's with the php before your foreach loop?

     

    <?php
    
    $NewJoyCard = mysql_query("SELECT count(*) FROM subscribers WHERE formid = 4 and DATE(FROM_UNIXTIME(requestdate)) = CURRENT_DATE()");
    
      foreach($rowTotJoyCard as $field) { 
        if($field >0){
          echo'<a href="javascript:popUp(\'details2.php?MR=TotJoyCard&Reg=Total Joy Card Signups&Tot=$field\')">'.$field.'</a>';
        }
          else
          {
            echo "0";
          }
      }
    ?>

  4. <?php
    
       krsort($array); //Sort your array in reverse order by key.
       $highest = key($array); //Get array's current key
       ksort($array); //Back to normal.
    
    ?>

     

    Or....

     

    <?php
    
       end($array);
       $highkey = key($array);
       next($array);
    
    ?>

     

    I suppose array_keys isn't much help since it just returns another array with keys. We can get those from the original array anyway. It is possible there's a much better way...but it's early and I haven't had my corporate fave Starbucks yet.

  5. I think your caps lock button is stuck buddy.

     

    That aside, can you please give us some specifics like, what OS your server is running (Hopefully a *nix/Apache setup and not a craptastic Windows/IIS setup). Thanks.

  6. Look into using DISTINCT in your SQL query....but idealy, you want to use some kind of unique identifier in your records...otherwise, makes for crappy work arounds that may be more trouble than they're worth. Good database design is paramount. :-)

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