Re: Need a PHP clue
| From: | (Jonathan Chum) | Date: | Thu, 10 Aug 2000 17:33:37 +0000 |
| Subject: | Re: Need a PHP clue | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-11191@lists.php.net to get a copy of this message | ||
Thanks for the insight. I just figured it out just a few mins ago a
way to do it without restructuring my polls db since it's relational
to the forum db that I constructed. Basically, I added a hidden type
form object with the id of each question and in the script, checked to
see if this hidden type object had been set before it attempts to
perform the operations. Thanks anyway though . . .
On 10 Aug 2000 10:30:28 -0700, me@hansanderson.com ("Hans H.
Anderson") wrote:
>Jonathan,
>
>I have such a thing on one of my sites (see
>http://www.goofiness.com/personality/). The admin side, for
>adding,
>updating and deleting questions is setup this way:
>
>I have a table in my database for the questions/answers. I chose to not
>over-normalize the tables, because of the simplicity of the setup. So, my
>MySQL table looks like this:
>
>PersonalityID
>Question
>AnswerA
>AnswerB
>AnswerC
>AnswerD
>AnswerE
>AddedDate
>
>Those datatypes are Int, 6 mediumtext and one Date.
>
>If a particular question has only 3 answers, then AnswerD and AnswerE are
>left blank. When my PHP front end pulls up a test, it checks
>
>if($AnswerE!='') {
> print $AnswerE;
>}
>
>etc.
>
>The admin form to add and update has 6 textareas, one for the question and
>each answer. There is a hidden field for the PersonalityID. When
>updating, I use a query like this:
>
>update Personality set Question = '$Question', AnswerA = '$AnswerA'
>...blah,blah... where PersonalityID = $PersonalityID
>
>When I first set out to do this, 3 1/2 years ago, I had this uber
>normalized db that stored questions in one table and answers in another.
>This was too complex, though, for the simple and straightforward needs I
>had.
>
>Hope that helps,
>
>Hans
>
>
>On Thu, 10 Aug 2000, Jonathan Chum wrote:
>
>> I really need some help with this one guys.
>>
>> I am trying to create an edit function for my poll script. Modifying
>> questions is not a problem, only when it comes to editing, updating,
>> and deleting the answers possible for the poll. I'd like to do it in
>> one step.
>>
>> My table is organized with a unique id for each answer to the poll, a
>> pollid column which is uses to see which answer will be shown for what
>> poll, and the answer it self.
>>
>> Each poll has a max of 5 questions, so 5 text boxes are created. In
>> each text box, the answer is prefilled. Now here's the problem. . . I
>> cannot figure out how to pass the info to PHP so that it knows where
>> to find the row and do either an update, insert, or delete.
>>
>> I was trying to have the name tag of each text box be the unique id
>> and the value will be an answer to the poll. Problem is that I cannot
>> figure how with PHP to know the variable name which is passed and
>> hence, I cannot do the tasks needed.
>>
>> Basically I need to pass some how, an identifier for each of the 5
>> answer text box so I can perform a query using WHERE.
>>
>> Any ideas? Thanks.
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
>> For additional commands, e-mail: php-general-help@lists.php.net
>> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>>
>>
>>
>
>Hans Anderson ~ me@hansanderson.com
>PO Box 426, Missoula, MT 59806 | PHP, Search Engines, SQL
> (800)397-9116 / (406)549-6524 | Databases, Flash Multimedia,
> http://www.hansanderson.com | Killer Audio Production,
> http://www.goofiness.com | Minty Fresh Breath.