The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.2.25 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/printthread.php 16 require_once
Warning [2] Undefined property: MyLanguage::$archive_pages - Line: 2 - File: printthread.php(287) : eval()'d code PHP 8.2.25 (Linux)
File Line Function
/printthread.php(287) : eval()'d code 2 errorHandler->error
/printthread.php 287 eval
/printthread.php 117 printthread_multipage



UserSpice
Running Update Query - Printable Version

+- UserSpice (https://userspice.com/forums)
+-- Forum: Miscellaneous (https://userspice.com/forums/forumdisplay.php?fid=28)
+--- Forum: Off-topic Discussions (https://userspice.com/forums/forumdisplay.php?fid=10)
+--- Thread: Running Update Query (/showthread.php?tid=381)

Pages: 1 2 3 4


Running Update Query - Brandin - 12-28-2016

No I have not made any changes to the db class.


Running Update Query - mudmin - 12-28-2016

Ok. I'm seeing now. I don't think there is anything in those changes to the DB class that really NEEDS to be in the class. Those functions would work just as well in the usersc/custom_functions file and then you would be able to receive updates without breaking things. I'll look at the rest of the code.


Running Update Query - Brandin - 12-28-2016

OHHHHH, like my migrateCat and migrateTemplate functions? Move those to custom_functions? Do I have to do any additional loading?


Running Update Query - mudmin - 12-28-2016

Do you know which queries are triggering your errors? My guess is that it's somewhere in the
Code:
$status='1';
Code:
$db->approveRequest('templatesrequest',$id,$status);
Code:
$modifieduid = $uid;
Code:
$db->approveRequest2('templatesrequest',$id,$modifieduid);



Running Update Query - Brandin - 12-28-2016

mudmin, I'm really not sure. If I remove any of those queries I will never know what caused it, and if I 'die()' the page doesn't load so I can't tell what is doing it.


Running Update Query - mudmin - 12-28-2016

Ahh. Ok. Well, if you could help me figure out which query is the problem, I can help.

If you move those functions to custom functions you will have to make a few little changes like put the DB:Get instance thing at the top of the function (you can look in us_helpers for an example) and then get rid of the $this and change it to $db. Again, looking in us_helpers will show you a difference between writing it as a method (in a class) and function (not in a class). But even before that, let's figure out where the problem is...


You don't just have to put die. You can give a description, so I would start at the top and change

Code:
if($validation->passed()){
Code:
$db->update('templates',$requestid,$fields);
Code:
$successes[] = "Long Name Updated";
to

Code:
if($validation->passed()){
Code:
$db->update('templates',$requestid,$fields);
Code:
die('made it to the long name update');
Code:
$successes[] = "Long Name Updated";

If you make it that far and you see the die message but no error on line 50 error then you know there is no problem with that query so go to the next one...

Code:
if($validation->passed()){
Code:
$db->update('templates',$requestid,$fields);
Code:
die('made it to the text update');
Code:
$successes[] = "Text Updated";

Do that for each query (one at a time) and once you see the error pop up, you will know which one is causing you the problem and we can fix it.



Running Update Query - Brandin - 12-30-2016

mudmin,

You're a genius man! It looks like my problem lies with these lines on my
Code:
templatesreqedit.php
https://hastebin.com/vagosanoqi.php

Lines 112-115 on my original haste. Any thoughts on why? Could it have something to do with the fact I am posting numerical values instead of text values? Or what? Hmmm...

Thanks!


Running Update Query - mudmin - 12-30-2016

I would get those two functions out of the db class and put them in usersc/includes/custom_functions.php. I redid them for you...

https://hastebin.com/wokaqataji.xml


Running Update Query - Brandin - 12-30-2016

Okay, so I moved them, as well as the migrateTemplate and migrateCat stuff I added, but now it is producing this error:
Code:
Fatal error: Call to undefined method DB::approveRequest() in /home/aircentralized/public_html/boss/usersc/includes/external/templatesreqedit.php on line 113

Seems like it can't find the function. Thoughts? Am I doing something wrong?
My custom_functions.php:
https://hastebin.com/ujehokuqad.xml


Running Update Query - dan - 12-31-2016

You need to put the functions in users/includes/custom_functions.php or it could be in some kind of script folder but there is already a file called custom functions it is automatically included in every single page.

Then you need to remove the $db-> from in front of approved equestrian when you call your functions on your pages