Running Update Query - Printable Version

+- UserSpice (
+-- Forum: Miscellaneous (
+--- Forum: Off-topic Discussions (
+--- Thread: Running Update Query (/showthread.php?tid=381)

Pages: 1 2 3 4

Running Update Query - Brandin - 12-03-2016


I am using the UserSpice pages in many ways, and one of them is a migration tool. Basically, I have a list of categories, and if I migrate the category number to be another number, I also want to update all of the templates with that category number, to the new one. Currently, I am using the default function from the
page that I just modified to my good, and I have this:

//Update catnum

    if ($number != $_POST['number']){
       $number = Input::get("number");

        'number' => array(
          'display' => 'Number',
          'required' => true,
          'min' => 1,
          'max' => 3
      $successes[] = "Sort Updated";

But what I need to do is also update the
WHERE category=
the new
I have set.

If you could help with the
function for this, I would be VERY appreciative Smile

Thanks again!

Running Update Query - Brandin - 12-03-2016

I posted this on HasteBin since it went crazy on here:

Running Update Query - mudmin - 12-19-2016

I missed this one. I was on vacation. Did you get it figured out?

Running Update Query - Brandin - 12-19-2016

I did - I'll pull the code to let you know what I did later today. Hope you enjoyed your vacation!

Running Update Query - Brandin - 12-22-2016

Now when I am running the update query this happens:

Warning: Invalid argument supplied for foreach() in /home/aircentralized/public_html/boss/users/classes/DB.php on line 50

Warning: Invalid argument supplied for foreach() in /home/aircentralized/public_html/boss/users/classes/DB.php on line 50

Line 50 is:
foreach ($params as $param) {
What does parms have to do with anything when I'm not calling for parms?


Running Update Query - mudmin - 12-22-2016

PHP didn't give you the most helpful error there. That error is part of the db->query method, so there is a problem with one of your queries. Go through any time you did any db queries on that page and see if there are any errors...

If you're kind of lost on where you messed up, just put


after a query (starting from the top of the page) and reload the page. If you don't get that error, remove that die and put it after the next one.

Once you get the error, the query before the die is the one that is causing you a problem.

Running Update Query - Brandin - 12-26-2016

Hey mudmin,

I've tried doing this but it ends up stopping the page from loading because I'm using die(); in queries that load the page. This only happens when I actually perform an update, so it seems as if is something to do with the update query, but this is the same query from the default UserSpice pages, just modified for this purpose (only change the update values and table and stuff). It occurs on every page after I perform an update function.


Running Update Query - mudmin - 12-28-2016

Can you pastebin the latest version of this code and I can figure it out for you?

Running Update Query - Brandin - 12-28-2016


This performs an update, and then gives me the error above, which is linked to the DB.php file which is here:

Excuse this mixed use of mysqli queries and PDO lmao - I'm still trying to convert all of my stuff to PDO.

Running Update Query - mudmin - 12-28-2016

So just double checking...did you modify the db class?