klodovik Posted November 27, 2009 Share Posted November 27, 2009 Hello! I would like to do a page with something like quiz. "Quiz" will have questions and then there will be check boxes below it(around 15). And regarding ticked boxes page will show result(s) from base. I already did 3 tables in mysql but I dont know how to write the coding. Could somebody help me? klodovik Quote Link to comment https://forums.phpfreaks.com/topic/183118-diagnosis-application/ Share on other sites More sharing options...
JonnoTheDev Posted November 27, 2009 Share Posted November 27, 2009 but I dont know how to write the coding If you aren't a programmer then I suggest you get a book on php website development. You will not get help in the forum unless you show that you have the ability to lay down the basic code and logic. If you need this developing for you then I suggest you post in the relevent section. Quote Link to comment https://forums.phpfreaks.com/topic/183118-diagnosis-application/#findComment-966475 Share on other sites More sharing options...
klodovik Posted November 28, 2009 Author Share Posted November 28, 2009 http://www.martinfrelih.com/test/phptest.php This is my not-working page. And here is code, which also doesn't work. http://www.martinfrelih.com/test/koda.txt What's wrong? Quote Link to comment https://forums.phpfreaks.com/topic/183118-diagnosis-application/#findComment-967100 Share on other sites More sharing options...
klodovik Posted December 6, 2009 Author Share Posted December 6, 2009 Here is the code, whats wrong? I would be very happy if somebody would answer. http://martinfrelih.com/test/phptest.php <html> <head> <title>test stran</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> </head> <body> <div align="center" id="container"> <?php // Make a MySQL Connection mysql_connect("localhost", "username", "password") or die(mysql_error()); mysql_select_db("martinfr_baza1") or die(mysql_error()); // Get all the data from the "example" table $result = mysql_query("SELECT * FROM property") or die(mysql_error()); echo "<table border='1'>"; echo "<tr> <th>Id number</th> <th>Title</th> </tr>"; // keeps getting the next row until there are no more to get while($row = mysql_fetch_array( $result )) { // Print out the contents of each row into a table echo "<tr><td>"; echo $row['id']; echo "</td><td>"; echo $row['title']; echo "<input name='property[]' type='checkbox' value='id'>"; echo "</td></tr>"; } echo "</table>"; echo "<input name='send' type='submit' id='send' value='Send!'>"; echo "<br />"; $result = mysql_query("SELECT * FROM item") or die(mysql_error()); echo "<table border='1'>"; echo "<tr> <th>Id number</th> <th>Title</th> </tr>"; // keeps getting the next row until there are no more to get while($row = mysql_fetch_array( $result )) { // Print out the contents of each row into a table echo "<tr><td>"; echo $row['id']; echo "</td><td>"; echo $row['title']; echo "</td></tr>"; } echo "</table>"; $countmatch = array(); // v $allItemProperties moraĹĄ immeti vse lastnosti iz tabele ItemProperty foreach($allItemProperties as $item){ if(isset($_POST["property"][$item["property_id"]])){ // Äe obstaja(je oznaÄena) lastnost. $countmatch[$item["item_id"]]++; // poveÄaj ĹĄtevec za trenutni sladoled } } $result = mysql_query("SELECT * FROM item_property") or die(mysql_error()); while($row = mysql_fetch_array( $result )) { if(isset($_POST["property"][$row["property_id"]])){ // če obstaja(je označena) lastnost. $countmatch[$row["item_id"]]++; // povečaj števec za trenutni sladoled } } // sedaj imaĹĄ urejena ujemanja in moraĹĄ samo ĹĄe poiskati kateri sladoled ima najboljĹĄe ujemanje. $maxCount = 0; $maxCoundItemId=null; foreach ($countmatch as $key=>$value) { if($value>$maxCount){ $maxCount=$value; $maxCountItemId = $key; } } echo "$maxCountItemId"; ?> </div> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/183118-diagnosis-application/#findComment-972448 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.