-
February 7th, 2008, 03:49 PM
#1
Php function isnt working!
Well it kind of does..
$NewTicketType = $_POST['NEW_FK_TICKET_TYPE_ID'];
$NewTicketSubType = $_POST['NEW_FK_TICKET_SUB_TYPE_ID'];
$NewTicketID = LookUpIdById($NewTicketType,$NewTicketSubType);
echo $NewTicketID;
Now if I do that it doesnt work but if I put in
$NewTicketID = LookUpIdById(1,1); it does work...
I have already verified that $NewTicketType and NewTicketSubType are equal to 1 by echoing them too... Thoughts?
Last edited by oofki; February 7th, 2008 at 03:56 PM.
-
February 7th, 2008, 03:57 PM
#2
Originally Posted by oofki
Thoughts?
Check if $NewTicketType and $NewTicketSubType actually get assigned what you've POST'ed.
Edit: oeps.. You've already checked that
Oliver's Law:
Experience is something you don't get until just after you need it.
-
February 7th, 2008, 04:27 PM
#3
Yeah its really frustrating im not sure if there is a way to force a variable to be an integer because maybe it is seeing it a string and wont work?
-
February 7th, 2008, 04:28 PM
#4
What does that function look like (just the basics)?
You could also force the conversion to integer with $integer = intval($somestring);
Last edited by SirDice; February 7th, 2008 at 04:34 PM.
Oliver's Law:
Experience is something you don't get until just after you need it.
-
February 7th, 2008, 04:36 PM
#5
Originally Posted by oofki
Yeah its really frustrating im not sure if there is a way to force a variable to be an integer because maybe it is seeing it a string and wont work?
Does your function rely on them being integers? If so, you could use is_int (in an if statement) to verify that you have an integer and if you don't, you could use int to cast it to an integer... I forget what php considers values to be from a post.
Example int usage:
$x = "1";
$y = (int)$x;
is_int($x) is False
is_int($y) is True
-
February 7th, 2008, 04:43 PM
#6
Well the function looks like:
function LookUpIdById($parent_id,$child_id)
{
$where = "where PARENT_ID=$parent_id and CHILD_ID=$child_id ";
return($this->LookUpOneColumn("ID",$where));
}
It works fine if i put in the numbers but not the variables like I said I will try that int function :-)
-
February 7th, 2008, 04:51 PM
#7
i tried intval() and it still doesnt work!!!
-
February 7th, 2008, 05:03 PM
#8
$where = "where PARENT_ID=$parent_id and CHILD_ID=$child_id ";
Because of this it shouldn't really matter if $parent_id is a string or an integer as it all gets converted to strings anyway..
Weird.. Try echo'ing the values inside the function.. See if that's different..
Oliver's Law:
Experience is something you don't get until just after you need it.
-
February 7th, 2008, 07:19 PM
#9
Okay I figured it out. Basically the subtype that I had was already the ID that would be produced by that function and I did not need to even run it :-)
Thanks for the thoughts SirDice and HtRegz :-D
-
March 7th, 2008, 03:55 AM
#10
A mind full of questions has no room for answers
Similar Threads
-
By HTRegz in forum The Security Tutorials Forum
Replies: 12
Last Post: January 28th, 2006, 08:02 PM
-
By embro1001 in forum Other Tutorials Forum
Replies: 0
Last Post: July 16th, 2005, 05:25 PM
-
By nightcat in forum The Security Tutorials Forum
Replies: 9
Last Post: May 28th, 2005, 02:47 AM
-
By journy101 in forum Newbie Security Questions
Replies: 1
Last Post: May 1st, 2003, 06:16 AM
-
By jethro in forum Other Tutorials Forum
Replies: 5
Last Post: November 3rd, 2002, 03:09 PM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|