close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Operand should contain 1 column(s)

Thread began 3/15/2016 2:42 pm by Kumel | Last modified 3/28/2016 9:03 am by Ray Borduin | 3355 views | 22 replies |

Kumel

Operand should contain 1 column(s)

Wierd error: Operand should contain 1 column(s)
This is appearing after i added

AND UserGroupID = (2,11)



<?php
mysql_select_db($database_con1, $con1);
$query_Employees = "SELECT * FROM Users WHERE ID IN (".$row_UsersMachines['EmpID'].") AND UserGroupID = (2,11)";
$Employees = mysql_query($query_Employees, $con1) or die(mysql_error());
$row_Employees = mysql_fetch_assoc($Employees);
$totalRows_Employees = mysql_num_rows($Employees);
?>



The results of these are not shown. When i remove AND UserGroupID = (2,11) results are shown. But i need this filter that UserGroupID must be 2 or 11.

File attached.

Sign in to reply to this post

Ray BorduinWebAssist

That should be: AND UserGroupID IN (2,11)

Sign in to reply to this post
Did this help? Tips are appreciated...

Kumel

AND UserGroup IN (2,11)?

U mean AND UserGroupID?

I tried both .. didnt work..

If i do UserGroup says wrong column & UserGroupID then



You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1

Sign in to reply to this post

Kumel

Under User Table there is :

Name, Email, UserGroupID

Sign in to reply to this post

Ray BorduinWebAssist

Yes UserGroupID.... you can't pass multiple values with an '=' comparison... you need to use IN if you want to pass more than one value comma separated.

Sign in to reply to this post
Did this help? Tips are appreciated...

Kumel

Getting this error : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1

Sign in to reply to this post

Ray BorduinWebAssist

Write your SQL statement to the page and see what it looks like:

$query_Employees = "SELECT * FROM Users WHERE ID IN (".$row_UsersMachines['EmpID'].") AND UserGroupID IN (2,11)";
die($query_Employees);

My guess is that the UsersMachines Recordset isn't returning a result.

Sign in to reply to this post
Did this help? Tips are appreciated...

Kumel

FYI the RS is within repeat region of UsersMachine.
I tried as above. Error :


SELECT * FROM Users WHERE ID IN (6) AND UserGroupID IN (2,11)


UserMachine RS:

<?php

$colname_UsersMachines = "-1";
if (isset($_POST['validation-classic-machine'])) {
$colname_UsersMachines = $_POST['validation-classic-machine'];
}
mysql_select_db($database_con1, $con1);
$query_UsersMachines = sprintf("SELECT * FROM UsersMachines WHERE MachineID = %s", GetSQLValueString($colname_UsersMachines, "int"));
$UsersMachines = mysql_query($query_UsersMachines, $con1) or die(mysql_error());
$row_UsersMachines = mysql_fetch_assoc($UsersMachines);
$totalRows_UsersMachines = mysql_num_rows($UsersMachines);
?>



It is using form post to filter with MachineID.. UserMachine is a relational-table of .

Sign in to reply to this post

Ray BorduinWebAssist

That looks like a good SQL statement to me. I'm not sure why it would error. Is it possible a different recordset is throwing the error?

Try cutting and pasting that SQL statement into phpMyAdmin and see if it works.

Sign in to reply to this post
Did this help? Tips are appreciated...

Kumel

But a if (isset($_POST['validation-classic-machine'])) {
post value is required. There are 2 RS.

File attached

Sign in to reply to this post
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...