Reputation: 28284
I have this SQL by a programmer:
$sql = "
INSERT INTO
`{$database}`.`table`
(
`my_id`,
`xType`,
`subType`,
`recordID`,
`textarea`
)
VALUES
(
{$my_id},
?xType,
?subType,
{$recordID},
?areaText
) ";
My question is why is he using ?
before values? How do I see what values are coming in? I did echo
and it shows ?xType
as ?xType
. No values. What does ? stand for in SQL?
Upvotes: 1
Views: 321
Reputation: 3460
Here's another crazy idea -- you're maintaining someone else's code, right? Does it actually work/run? If not, did he put in the question mark because he wasn't sure of that parameter or the name of the parameter? Sometimes I put in stuff that doesn't compile because I know it will force me to go back and figure it out later (so I don't forget).
Upvotes: -1
Reputation:
John Weldon is right in this case but i have seen sql like the below where ? means it is a placeholder for a value. The sql is accompanied by parameters equal to the amount of ?'s in the sql. In that case it means pull the value from the parameter and escape it.
INSERT INTO
`{$database}`.`table`
(
`my_id`,
`xType`,
`subType`,
`recordID`,
`textarea`
)
VALUES
(
?,
?,
?,
?,
?
) ";
Upvotes: 1
Reputation: 382716
Looks to be a place holder to be parsed by some sort of parser. Possibly they are under some framework.
Upvotes: -1