× 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
#21
Ahhhhh! It was the $db-> thing! Thank yewwww!
  Reply
#22
Here's another one to make me sound stupider Wink I have a page that needs to change values in 3 tables when I press update. It changes the
Code:
dates
table properly, but I need it to update the
Code:
calls
and
Code:
orders
tables based on the
Code:
$date
value which is already defined. I am trying to replicate this using the approve functions you wrote for me, but it's not liking me. It keeps throwing
Code:
$isactivate is undefined errors
on my page.
Code:
isactivate
defined when the update is performed? Clearly it is because it does it in the
Code:
dates
table.

https://hastebin.com/wuvahisigu.php
  Reply
#23
The isactive error is coming because you have that variable in your function, but you are not getting that info from anywhere. I'm guessing you mean status.

What is the isactivate column supposed to have on it? Is it supposed to be a 1 or 0, yes or no? What data are you trying to get in there?
  Reply
#24
Mudmin,

Note my mispellings of
Code:
isactivate
instead of
Code:
isactive
lol. It is all correct in the code though. The
Code:
isactive
column is used in other portions of the system to verify if to include that call, order or date in the stats calculations.
Code:
isactive
is 1=Yes or 2=No, table defaults this column as 1. I have included the
Code:
ddfunction.php
page as a whole below:
https://hastebin.com/asopijopoj.xml

The
Code:
isactive
column is pulled from the DB, and is defined prior to the forms posted, and is defined again when the form posts, by the update query. So this properly updates the
Code:
dates
table, however when the validation runs the function to update the
Code:
orders
and
Code:
calls
table, it seems to not be able to pull the new
Code:
isactive
value. Why would this be?

Thanks for your help.
  Reply
#25
Let's take a crack at this. I'm going to guess that your procedural mysqli calls are right in your page itself, although I'm a bit rusty on that. I made a few changes to protect you against sql injections (hacks) on your $_GET variables.

If this isn't it, it's pretty close...here is your function...
https://hastebin.com/zajidawoqu.xml

Here is your full page
https://hastebin.com/zupudufuvo.xml

If you are still having problems, this is what I would check.
1. Echo your date and make sure it's in the same format as the one in the database.
2. Double check your column and table names Smile
3. Before line 57, I would do
Code:
die($date);
and then
Code:
die($isactive);
to make sure you have the right info there.



  Reply
#26
You sir, work wonders. I'm trying to get everything switched to PDO and injection proof but between coding new plugins for this system and work itself, it's hard to take the time! And I honestly cannot find a reason that it would be beneficial (other than the obvious) since I am currently the only one using the system. Prior to it being deployed to the entire team of more than 100 users, I'll definitely have to have it converted! Just not really a need right now. Mind you, it would probably make it easier in the long run so I don't have to manually do it later lol. Decisions, decisions! Thanks again Mudmin!
  Reply
#27
haha. I get that. I'm going to work on putting out a video on the db class. I think it would be super helpful on this sort of stuff. Glad to help!
  Reply
#28
That would be awesome! I think that's my biggest struggle, is learning how this system inserts, updates and queries the database. Although I can kind of grasp it by looking at the functions that are currently in the system, it is hard for me to fully understand how to adapt it to work with my new functions. Once I get told though, I understand! Lessons learned lol!
  Reply
#29
I just posted a 35 minute video detailing how to use the database class.
https://www.youtube.com/watch?v=rb0kD5tC...e=youtu.be
  Reply
#30
I just got around to watching this, and THANK YOU! That was hands down the most informative video I've watched when it has come to coding! Thanks again!
  Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)