Results 1 to 2 of 2

Thread: When in code below I have statusc='active' appears error ?

  1. #1
    Join Date
    Oct 2004
    Posts
    425
    Thanks
    4
    Thanked 1 Time in 1 Post

    Default When in code below I have statusc='active' appears error ?

    MySQL: When in code below I have statusc='active' AND in
    $query = "SELECT * FROM admin_bookings WHERE statusc='active' AND dated>='$today' ORDER BY $orderby ";
    appears the error:
    Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/content/p/o/l/polisch123/html/administration/bookings.php on line 194

    and only when this, where is the error (line 194:mysql_free_result($result);)?

    Code:
    <?php 
    // ------------------------------
    include("../dbinfo.php");
    $linkid = mysql_connect($hostname,$username,$password);
    @mysql_select_db($database) or die( "Unable to select database");   // @
    // Base query 
    $today = time()-30*24*60*60;
    $query ='';
    // $email6=$_SESSION['email'];  //from above non needed
    if (($_GET['orderby'] == "") && ($_SESSION['orderby'] == "")) {
       $_SESSION['orderby'] = "dateplaced DESC";
       $orderby = $_SESSION['orderby'];
    } else if (($_GET['orderby'] != "") && (($_SESSION['orderby'] == "") || ($_SESSION['orderby'] != ""))) {
       $orderby = $_GET['orderby'];
       $_SESSION['orderby'] = $orderby;
    } else if (($_GET['orderby'] == "") && ($_SESSION['orderby'] != "")) {
       $orderby = $_SESSION['orderby'];  
    }
     
    // -----------
    $active = 'active';
    $query_view = "CREATE VIEW admin_bookings (name,mob,fixed,statusc,email,bookingid,dateplaced,status,datep,dated,Locationp,Locationd,days,mostdaysrate,vat,off,total,cat) AS
    SELECT $CustomersTable.name,$CustomersTable.mob,$CustomersTable.fixed,$CustomersTable.status,$CustomersTable.email,$BookingsTable.bookingid,$BookingsTable.dateplaced,$BookingsTable.status,$BookingsTable.datep,$BookingsTable.dated,$BookingsTable.Locationp,$BookingsTable.Locationd,$BookingsTable.days,$BookingsTable.mostdaysrate,$BookingsTable.vat,$BookingsTable.off,$BookingsTable.total,$BookingsTable.cat 
    FROM $CustomersTable, $BookingsTable
    WHERE AND $CustomersTable.email = $BookingsTable.email"; //$CustomersTable.status = $active 
    //  ----------
    
    $result_view = @mysql_query($query_view,$linkid);
    $query = "SELECT * FROM admin_bookings WHERE statusc='active' AND dated>='$today' ORDER BY $orderby "; 
    
    $result = @mysql_query($query,$linkid);
    $count = @mysql_num_rows($result);
    echo "  ( Your query returned " . $count . " items. )";
    ?>

  2. #2
    Join Date
    Oct 2004
    Posts
    425
    Thanks
    4
    Thanked 1 Time in 1 Post

    Default

    I think $CustomersTable.status is PK.

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
  •