Hallo, is er een alternatief voor het SQL commando 'AND'? Ik maak gebruik van een Pervasive Btrieve DB en ik heb het idee dat hij AND niet herkent..

dit is mijn huidige query;
<?
$group_03_query = "SELECT * FROM ".$table." WHERE (".$table_column_03." LIKE '".$group_02[$table_column_03]."' AND ".$table_column_02." LIKE '".$group_01[$table_column_02]."') GROUP BY ".$table_column_04;
$group_03_result = odbc_exec($connectie,$group_03_query) or trigger_error("Could not connect to tabel (update DDF files)");
?>
dan is het nog altijd && , maar ik denk van niet
even in de handleiding ervan kijken?
Waaruit leidt je af dat de error door je AND komt? Kun je de error eens laten zien? Ik vermoed dat het meer met je GROUP BY te maken heeft, kijk ook eens naar de SQL HAVING() functie.
Welke foutmelding krijg je retour? Echo voor het gemak ook de query eens even, dan weet je precies wat er nu richting de database wordt gestuurd.

En wat Remco ook al zegt, het zou best wel eens de GROUP BY kunnen zijn.
@Hipska; er is geen duidelijke handleiding over Pervasive net als MySQL

Nee ik krijg geen fouten... dat is het hem juist..

Ik maak gebruik van link select fields (zie script (4 velden) in de library hier), waaarvan de eerste 2 velden het gewoon doen, en de 3e en 4e niet...
Alleen bij de 3e en 4e maak ik gebruik in de query van AND, dus das het enige verschil
Ik heb het eerst gebruikt in combinatie met MySQL en toen deed hij het wel en nu met Pervasive Btrieve (ODBC dus) va nExact for Windows...
Hier mijn script;
<?php
function quad_linked_selects(
$table, // Table name
$table_column_01, // Root category
$table_column_02, // Available items in sub category
$table_column_03, // Available items in sub-sub category
$table_column_04, // Available items in sub-sub-sub category
$group_02_default_option_text, // Default option text for the group 2 select
$group_03_default_option_text, // Default option text for the group 3 select
$group_04_default_option_text) // Default option text for the group 4 select
{
error_reporting(E_ALL);

include ('W:/Web/Index/odbcconf.php');
// Database connection
$connectie = odbc_connect("conectienaam","","") or die("Could not connect to ODBC client (Main connection)");

// Define globals
global $javascript;
global $group_01_options;
// Define variables
$javascript = null; // Holds all the generated javascript
$group_01_options = null; // Holds all the select options for group 1
// Static Javascript
$javascript .=<<<content
/* Linked Dropdown Selects Script Start */
function DefaultGroup2()
{
var x = document.getElementById("Group2");
x.length = 0;
VarGroup2 = document.getElementById("Group2");
VarGroup2.options[VarGroup2.options.length] = new Option("$group_02_default_option_text","");
document.getElementById("Group2").disabled = true;
}
function DefaultGroup3()
{
var x = document.getElementById("Group3");
x.length = 0;
VarGroup3 = document.getElementById("Group3");
VarGroup3.options[VarGroup3.options.length] = new Option("$group_03_default_option_text","");
document.getElementById("Group3").disabled = true;
}
function DefaultGroup4()
{
var x = document.getElementById("Group4");
x.length = 0;
VarGroup4 = document.getElementById("Group4");
VarGroup4.options[VarGroup4.options.length] = new Option("$group_04_default_option_text","");
document.getElementById("Group4").disabled = true;
}
function ClearGroup3()
{
var x = document.getElementById("Group3");
x.length = 0;
document.getElementById("Group3").disabled = false;
}
function ClearGroup4()
{
var x = document.getElementById("Group4");
x.length = 0;
document.getElementById("Group4").disabled = false;
}
function CheckGroup1Select()
{
// If no Group1 is selected clear the Group2 and Group3 selects and set them to their default values
if(document.getElementById("Group1").value == "")
{
// Clear the Group2 select and set to default value
DefaultGroup2();
// Clear the Group3 select and set to default value
DefaultGroup3();
// Clear the Group4 select and set to default value
DefaultGroup4();
}
content;
// Groups 1 & 2 Javascript
$group_01_query = "SELECT u_merk FROM ".$table." WHERE (artcode LIKE '".$_GET['artgrp'].".%') GROUP BY u_merk";
$group_01_result = odbc_exec($connectie,$group_01_query) or trigger_error(odbc_error());
while($group_01 = odbc_fetch_array($group_01_result))
{
$group_01_options .= '<option value="'.$group_01[$table_column_01].'">'.$group_01[$table_column_01].'</option>'."\r\n";
$javascript .=<<<content
else if(document.getElementById("Group1").value == "$group_01[$table_column_01]")
{
// Clear the Group2 select and set to default value
DefaultGroup2();
// Set dynamic options for Group2 select
VarGroup2 = document.getElementById("Group2");
content;
$group_02_query = "SELECT ".$table_column_02." FROM ".$table." WHERE (".$table_column_01." LIKE '".$group_01[$table_column_01]."') GROUP BY ".$table_column_02;
$group_02_result = odbc_exec($connectie,$group_02_query) or trigger_error(odbc_error());
while($group_02 = odbc_fetch_array($group_02_result))
{
$javascript .=' VarGroup2.options[VarGroup2.options.length] = new Option("'.$group_02[$table_column_02].'","'.$group_02[$table_column_02].'");'."\r\n";
}
$javascript .=<<<content
document.getElementById("Group2").disabled = false;
// Clear the Group3 select and set to default value
DefaultGroup3();
DefaultGroup4();
}
content;
}
$javascript .=' }'."\r\n";
// Group 3 Javascript
$javascript .=<<<content
function CheckGroup2Select()
{
content;
$group_01_query = "SELECT ".$table_column_01." FROM ".$table." GROUP BY ".$table_column_01."";
$group_01_result = odbc_exec($connectie,$group_01_query) or trigger_error(odbc_error());
while($group_01 = odbc_fetch_array($group_01_result))
{
$javascript .=<<<content
if((document.getElementById("Group1").value == "$group_01[$table_column_01]") && (!document.getElementById("Group2").value))
{
// Clear the Group3&4 select and set to default value
DefaultGroup3();
DefaultGroup4();
}
content;
$group_02_query = "SELECT ".$table_column_02." FROM ".$table." WHERE (".$table_column_01." LIKE '".$group_01[$table_column_01]."') GROUP BY ".$table_column_01.",".$table_column_02;
$group_02_result = odbc_exec($connectie,$group_02_query) or trigger_error(odbc_error());
while($group_02 = odbc_fetch_array($group_02_result))
{
$javascript .=<<<content
else if((document.getElementById("Group1").value == "$group_01[$table_column_01]") && (document.getElementById("Group2").value == "$group_02[$table_column_02]"))
{
DefaultGroup3();
VarGroup3 = document.getElementById("Group3");
content;
$group_03_query = "SELECT ".$table_column_03.", ".$table_column_04." FROM ".$table." WHERE ".$table_column_01." LIKE '".$group_01[$table_column_01]."' AND (".$table_column_02." LIKE '".$group_02[$table_column_02]."') GROUP BY ".$table_column_03.",".$table_column_04."";
$group_03_result = odbc_exec($connectie,$group_03_query) or trigger_error(odbc_error());
while($group_03 = odbc_fetch_array($group_03_result))
{
$javascript .=' VarGroup3.options[VarGroup3.options.length] = new Option("'.$group_03[$table_column_03].'","'.$group_03[$table_column_03].'");
VarGroup4.options[VarGroup4.options.length] = new Option("'.$group_03[$table_column_04].'","'.$group_03[$table_column_04].'");
'."\r\n" ;
}
$javascript .=' document.getElementById("Group3").disabled = false;
document.getElementById("Group4").disabled = false;
}'."\r\n";
}
}
$javascript .=<<<content
}
content;
// Group 4 Javascript
$javascript .=<<<content
function CheckGroup3Select()
{
content;
$group_01_query = "SELECT ".$table_column_01.", ".$table_column_02." FROM ".$table." GROUP BY ".$table_column_01.",".$table_column_02."";
$group_01_result = odbc_exec($connectie,$group_01_query) or trigger_error(odbc_error());
while($group_01 = odbc_fetch_array($group_01_result))
{
$javascript .=<<<content
if((document.getElementById("Group2").value == "$group_01[$table_column_02]") && (document.getElementById("Group3").value == "$group_02[$table_column_03]") && (!document.getElementById("Group4").value))
{
// Clear the Group4 select and set to default value
DefaultGroup4();
VarGroup4 = document.getElementById("Group4");
}
content;
$group_02_query = "SELECT ".$table_column_02.", ".$table_column_03." FROM ".$table." WHERE (".$table_column_02." LIKE '".$group_01[$table_column_02]."') GROUP BY ".$table_column_02.",".$table_column_03;
$group_02_result = odbc_exec($connectie,$group_02_query) or trigger_error(odbc_error());
while($group_02 = odbc_fetch_array($group_02_result))
{

$javascript .=<<<content
else if((document.getElementById("Group2").value == "$group_01[$table_column_02]") && (document.getElementById("Group3").value == "$group_02[$table_column_03]"))
{
DefaultGroup4();
VarGroup4 = document.getElementById("Group4");
content;
$group_03_query = "SELECT * FROM ".$table." WHERE ".$table_column_03." LIKE '".$group_02[$table_column_03]."' AND (".$table_column_02." LIKE '".$group_01[$table_column_02]."') GROUP BY ".$table_column_04;
$group_03_result = odbc_exec($connectie,$group_03_query) or trigger_error(odbc_error());
while($group_03 = odbc_fetch_array($group_03_result))
{
$javascript .=' VarGroup4.options[VarGroup4.options.length] = new Option("'.$group_03[$table_column_04].'","'.$group_03[$table_column_04].'");'."\r\n";
}
$javascript .=' document.getElementById("Group4").disabled = false;

}'."\r\n";
}
}
$javascript .=<<<content
}
window.onload = CheckGroup1Select;
/* Linked Dropdown Selects Script End */
content;
} // End of quad_linked_selects function
// Call the quad_linked_selects function
quad_linked_selects('artbst','u_merk','u_type','u_materiaal','u_maatvoerin','Selecteer...','Selecteer...','Selecteer...',$_GET['artgrp']);
?>
Dus ik zou zeggen dat AND de boosdoener is, omdat dit het enige verschil is.. :( kan iemand me please helpen??
Als ik mijn bescheiden mening mag geven...
Als jij een SQL server draait die geen AND ondersteunt, moet je je serieus afvragen waarom je dat zou doen. Misschien heb je geen keus, maar neem dan een andere host.
Nee, de administratie maakt gebruik van Exact for Windows, een softwarepakket welke debiteuren en artikelen informatie beheren mogelijk maakt (goed voor boekhouden).
De achterhangende DB hiervoor is een Btrieve DB, dus ideaal als je met ODBC kan koppelen... Anders moet ik exporteren naar xls en dan met navicat importeren naar MySQL... dus dan heb je alsnog niet via je intranet live gegevens va nje debiteuren en artikelen.. :(

Reageren