database question
Posted: Fri Jul 29, 2005 12:26 pm
heres a quick question for you guys. I'm currently working on a database app for my company. It pulls questions then answers from various tables then waits on a customers response before going to the next question. Now what I'm curious about is can you use variables in SQL statments in php? I'm thinking of something long the lines of the following
or would I need to do more of a case statement using qcode?
I would prefer the first method because it would be easier to manage than making an unreasonably large case statment that makes an individual statement based of $qcode. Not to mention I don't know exactly how many questions are going to be put into the database for them to be quized on so it makes doing it by case even more of a bad idea.
Code: Select all
$sql = "e;Select Questioncode from tblQuestion where Questioncode ="e; ."e;$qcode"e;;I would prefer the first method because it would be easier to manage than making an unreasonably large case statment that makes an individual statement based of $qcode. Not to mention I don't know exactly how many questions are going to be put into the database for them to be quized on so it makes doing it by case even more of a bad idea.