× This forum is read only. As of July 23, 2019, the UserSpice forums have been closed. To receive support, please join our Discord by clicking here. Thank you!

  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Running Update Query
#11
No I have not made any changes to the db class.
  Reply
#12
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.
  Reply
#13
OHHHHH, like my migrateCat and migrateTemplate functions? Move those to custom_functions? Do I have to do any additional loading?
  Reply
#14
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);
  Reply
#15
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.
  Reply
#16
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.
  Reply
#17
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!
  Reply
#18
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
  Reply
#19
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
  Reply
#20
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
  Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)