leonidassavvides
11-03-2008, 10:42 AM
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);)?
<?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. )";
?>
$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);)?
<?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. )";
?>