noirsith Posted July 24, 2008 Share Posted July 24, 2008 I looked through one of the tutorials listed here on connecting to database and was able to implement it, however my novice level in php still gives me trouble with what I'm trying to do so let me try to explain what I need to do and see how hard it would be to implement and if you guys have any recommendations. I'm trying to construct a quiz. I would like the question to be loaded from one table in the database (say called questions). The answers would be multiple choice and I would like the selected answers to be stored in another table called answers that will be tallied according to the Primary ID say the last name field. So essentially I need my main php or php files to call the database for questions and send data to the database when it comes to answers. What would be the code to do that? I'm even willing to settle with the questions being in main php file (as in not being called but being static) but answers would have to be sent and stored in my back-end database. Any help would be greatly appreciated. Thank you! Link to comment https://forums.phpfreaks.com/topic/116409-drawing-from-and-sending-to-a-database/ Share on other sites More sharing options...
DarkWater Posted July 24, 2008 Share Posted July 24, 2008 That's pretty basic MySQL stuff. Can I see your table structure? Link to comment https://forums.phpfreaks.com/topic/116409-drawing-from-and-sending-to-a-database/#findComment-598610 Share on other sites More sharing options...
noirsith Posted July 24, 2008 Author Share Posted July 24, 2008 I don't know how to go about showing it to you ... but essentially my database is going to be named noirsith_basicgrammar tables within it will be: tblQuestions (with just autoID also the primary key to number them and the actual row of questions) and tblAnswers (with rows for fName, lName, ID, ans1, ans2, ans3 and so on) I've set it up currently at blackapplehost.com if you want the login to take a peek lemme know. Link to comment https://forums.phpfreaks.com/topic/116409-drawing-from-and-sending-to-a-database/#findComment-598640 Share on other sites More sharing options...
DarkWater Posted July 24, 2008 Share Posted July 24, 2008 No, you can just show me a table structure dump with some sample data. If you have phpMyAdmin installed, just go to Export in the top when viewing a table. Link to comment https://forums.phpfreaks.com/topic/116409-drawing-from-and-sending-to-a-database/#findComment-598645 Share on other sites More sharing options...
noirsith Posted July 24, 2008 Author Share Posted July 24, 2008 Here's what I have, Table 1 -- phpMyAdmin SQL Dump -- version 2.8.2 -- http://www.phpmyadmin.net -- -- Host: localhost -- Generation Time: Jul 24, 2008 at 02:35 PM -- Server version: 5.0.27 -- PHP Version: 4.3.10-16 -- -- Database: `noirsith_basicgrammar` -- -- -------------------------------------------------------- -- -- Table structure for table `tblQuestions` -- CREATE TABLE `tblQuestions` ( `Number` varchar(2) NOT NULL, `Questions` varchar(255) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; -- -- Dumping data for table `tblQuestions` -- Table 2 -- -- Table structure for table `tblAnswers` -- CREATE TABLE `tblAnswers` ( `ID` int(6) NOT NULL, `fName` varchar(255) NOT NULL, `lName` varchar(255) NOT NULL, `Ans1` varchar(255) NOT NULL, `Ans2` varchar(255) NOT NULL, `Ans3` varchar(255) NOT NULL, `Ans4` varchar(255) NOT NULL, `Ans5` varchar(255) NOT NULL, `Ans6` varchar(255) NOT NULL, `Ans7` varchar(255) NOT NULL, `Ans8` varchar(255) NOT NULL, `Ans9` varchar(255) NOT NULL, `Ans10` varchar(255) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; -- -- Dumping data for table `tblAnswers` -- Link to comment https://forums.phpfreaks.com/topic/116409-drawing-from-and-sending-to-a-database/#findComment-598666 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.