SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Guru Richi's Avatar
    Join Date
    Jul 2001
    Location
    Hu,Bp.
    Posts
    842
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    random banner function, help ?!

    hi !
    what the erong with this code, am trying to do banner script, wich load images random by zone !

    PHP Code:

    <?require("db.php");?>

    <?
       
    function banner($action$ident) {

        if (
    $action == 'dynamic') {
          
    $banners_query mysql_query("select count(*) as count from $table where active = 'yes' and zone = '" $ident "'");

         
    $banners mysql_fetch_array($banners_query);

           echo 
    mysql_error();
          if (
    $banners['count'] > 0) {
            
    $banner = ("select id, company, image ,link ,html from $table where active = 'yes' and zone = '" $ident "'");
          } else {
            return 
    '<b>TEP ERROR! (banner(' $action ', ' $ident ') -> No banners with group \'' $ident '\' found!</b>';
          }
      }}

      echo 
    banner('dynamic','max');
     
    ?>
    the error msg :

    Code:
    Warning: Supplied argument is not a valid MySQL result resource in c:/foxserv/www/maviads/vi.php on line 15
    You have an error in your SQL syntax near 'where active = 'yes' and zone = 'max'' at line 1TEP ERROR! (banner(dynamic, max) -> No banners with group 'max' found!
    thx alot !

  2. #2
    SitePoint Guru Richi's Avatar
    Join Date
    Jul 2001
    Location
    Hu,Bp.
    Posts
    842
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    line 15 :

    $banners = mysql_fetch_array($banners_query);


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •