close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Update Where IN integer list

Thread began 5/25/2016 3:12 pm by Jason | Last modified 5/11/2017 12:35 pm by Ray Borduin | 3010 views | 16 replies |

Jason

Update Where IN integer list

I'm getting the following error
UPDATE access_userlogin SET sg_leader = ? WHERE userlogin_id IN ?

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

php:
if (!function_exists('getAllColumns')) {

    function getAllColumns($rs,$col) {
          $allColumns = "";
          for ($x=0; $x<sizeof($rs->Results); $x++) {
                    if ($allColumns) $allColumns .= ", ";
            $allColumns .= $rs->Results[$x][$col];
          }
          return $allColumns;
    }
}

$updated_leaders = new WA_MySQLi_RS("updated_leaders",$local_i,0);
$updated_leaders->setQuery("SELECT sg_smallgroup.leader FROM sg_smallgroup WHERE sg_smallgroup.smallgroup_start_date < ? AND (sg_smallgroup.smallgroup_end_date > ? OR sg_smallgroup.smallgroup_end_date IS NULL)");
$updated_leaders->bindParam("t", "".(date('Y-m-d', strtotime("-2 weeks")))  ."", "-1"); //WAQB_Param1
$updated_leaders->bindParam("t", "".(date('Y-m-d', strtotime("+2 weeks")))  ."", "-1"); //WAQB_Param2
$updated_leaders->execute();

if ("" == "") {
  $UpdateQuery = new WA_MySQLi_Query($local_i);
  $UpdateQuery->Action = "update";
  $UpdateQuery->Table = "access_userlogin";
  $UpdateQuery->bindColumn("sg_leader", "i", "1", "WA_DEFAULT");
  $UpdateQuery->addFilter("userlogin_id", "IN", "il", "".(getAllColumns($updated_leaders, "leader"))  ."");
  $UpdateQuery->execute();
  $UpdateGoTo = "";
  if (function_exists("rel2abs")) $UpdateGoTo = $UpdateGoTo?rel2abs($UpdateGoTo,dirname(__FILE__)):"";
  $UpdateQuery->redirect($UpdateGoTo);
}



I'm pretty certain the problem is with

$UpdateQuery->addFilter("userlogin_id", "IN", "il", "".(getAllColumns($updated_leaders, "leader")) ."");

How can I make this work?

Sign in to reply to this post

Ray BorduinWebAssist

Try updating the queryobj.php file... I've attached a newer beta version.

Attached Files
queryobj.php
Sign in to reply to this post
Did this help? Tips are appreciated...

Jason

This post has been deleted.

Jason

I'm getting an error on any query using the beta file for lines 340-348

Notice: Undefined variable: query in C:\xampp\htdocs\ALF\webassist\mysqli\queryobj.php on line 340

Notice: Trying to get property of non-object in C:\xampp\htdocs\ALF\webassist\mysqli\queryobj.php on line 340


Looks like the problem is coming from lines 315 or 316

php:
315        if (sizeof($this->RepeatedParams) > 0) $this->resetRepeated();

316        if (sizeof($this->ParamTypes)) {



The variable $query is defined inside of the "if" statement on 316, but it never matches the if statement. That's as far as I was able to follow the logic with the time I had.

Sign in to reply to this post

Ray BorduinWebAssist

Can I get FTP access and a URL and steps to reproduce the problem? I'll need to debug it further.

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

Jason

Disregard. The beta page works. The problem was this code at the top of my page.

php:
<?php

$BIG_SELECTS 
= new WA_MySQLi_Query($local_i);
$BIG_SELECTS->Statement "SET SESSION SQL_BIG_SELECTS = 1";
$BIG_SELECTS->execute();
?>



Not an issue on this page, but I do have some pages where I need to keep that code and would like to use the queryobj.php page. Any suggestions on modifying the BIG_SELECTS query to work with the beta page, or vice versa?

Sign in to reply to this post

Ray BorduinWebAssist

It might be a permissions issue not allowing the session set from the page for the connection. You could debug by writing information about the error causing the query to fail once this code is added back.

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

Jason

Hey Ray, is there a version of this file available now that will work for all my pages? Currently I can only use it in certain places where I need to do the WHERE IN il, because throws a bunch of errors on other pages. I have the original file and use it in most places and call this beta file in a few unique places, but I'd like to be able to just use one file so I don't have to separate my queries into different pages (calling both files on the same page seems to cause errors as well).

Sign in to reply to this post

Ray BorduinWebAssist

There is an updated version that is part of Data Bridge. I think it includes this fix and should be able to be used on all of your pages.

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

Jason

It says I have Data Bridge Version: 1.2.3 installed. That's the current version right? But, my queryobj.php file is version 1.5 (which is much older than the beta file). I'll attach my current queryobj.php file so you can take a look at it.

Attached Files
queryobj.php
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...