Jump to content

denno020

Members
  • Posts

    761
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by denno020

  1. Then those people don't deserve to see a good website lol. You're pretty much screwed. I guess it's up to the designer which minority they want to rule out of getting full functionality from the website..
  2. what about people who have cookies disabled, and whom are scared of cookies (yes I know people who know very little about computer and think that all cookies are viruses). Using AJAX should mean no one would have problems, no matter their security settings. Denno
  3. get the system time using PHP - there are built in functions, like date, I think. Check if the time is between the times you want. Log data. To re-run the code, you might need a javascript timer set up that would refresh the page automatically every 15 minutes. But that's if you're using it in a website context.. and I'm not sure how you could be...
  4. lol, you're welcome... I told you what you should have done so you could learn for yourself, QuickOldCar merely gave you the code... Anyway for your next question, can't do it. You need to use AJAX. Again, that reason is to do with where the code is executed.
  5. Alright I've got it to work. Here is the code that I'm using: <?php //connect to database require_once "connect_to_mysql.php"; $sqlCommand = "SELECT * FROM quiz"; $query = mysql_query($sqlCommand,$myConnection) or die (mysql_error()); $quiz = "<table width=600 border=1>"; $i = 0; while ($row = mysql_fetch_array($query)) { $i++; $question = $row["question"]; $answer1 = $row["answer1"]; $answer2 = $row["answer2"]; $answer3 = $row["answer3"]; $quiz .= "<tr><td> $question"; $quiz .= "</td></tr><br><tr><td>"; $quiz .= "<input type='radio' name='Q $i Choice' value='$answer1' />"; $quiz .= "$answer1"; $quiz .= "<input type='radio' name='Q $i Choice' value='$answer2' />"; $quiz .= "$answer2"; $quiz .= "<input type='radio' name='Q $i Choice' value='$answer3' />"; $quiz .= "$answer3"; $quiz .= "</td></tr>"; } $quiz .= "</table>"; mysql_free_result($query); ?> <!doctype html> <html> <head> <title>Test Page</title> <style type="text/css"> </style> </head> <body> <?php echo $quiz; ?> </body> </html> Give that a whirl and see what you come up with . Denno
  6. I'm going to set up something myself so I can do some testing and I'll get back to you. Also, you don't have to do: $i = $i++l simply: $i++; will suffice Denno
  7. $quiz .= "<input type='radio' name='Q" . "$i" . "Choice' value='$answer1' />"; You can try that, but the use of double quotes means that you can place variables into strings without having to escape and all that.. In what way doesn't it work? Does it give an error or anything? Denno
  8. http://www.tizag.com/sqlTutorial/sqlupdate.php http://www.w3schools.com/sql/sql_update.asp Did you honestly search?
  9. trying putting the javascript inside <?php ?> tags, and echoing it out to the page. Then you should be able to print the variable. The problem is that one is client side, and the other is server side. I'm not sure if this would work as expected, but it's worth a try. Denno
  10. I think something like this will work: //Connect to database mysql_connect($host, $dbusername, $password); mysql_select_db($TxQuizdb); //Retrieve Quiz Questions $qquery = mysql_query("SELECT * FROM Module_1_Quiz"); $quiz = "<table width=600 border=1>"; while ($row = mysqli_fetch_array($qquery)) { $question = $row["question"]; $answer1 = $row["answer_1"]; $answer2 = $row["answer_2"]; $answer3 = $row["answer_3"]; $quiz .= "<tr><td> $question"; $quiz .= "</td></tr><br><tr><td>"; $quiz .= "<input type='radio' name='Q1Choice' value='$answer1' />"; $quiz .= "$answer1"; $quiz .= "<input type='radio' name='Q1Choice' value='$answer2' />"; $quiz .= "$answer2"; $quiz .= "<input type='radio' name='Q1Choice' value='$answer3' />"; $quiz .= "$answer3"; $quiz .= "</td></tr>"; } $quiz .= "</table>" echo $quiz; The value in the square brackets next to $row is the name of each column with the question/possible answers in. ' .= ' means append data to the string, so it just adds it to the end. I've got the <table> starting tag outside of the loop, as this will put all of the information into the one table, instead of making multiple tables. I haven't tested the code above, so there is most definitely errors, just play around with it until you can get it to work, but that is the basic idea that you want. Denno
  11. So that doesn't work anymore? You've got the basic idea of what you need to do, is it just syntax somewhere? What doesn't work? What happens when you try to render the page with the code you've just posted? Denno
  12. To update any information in the database you need to do "UPDATE (table name){columns_names - if only updating a couple of columns, otherwise this can be ommited if a value will be placed into every column} VALUES (values)"; Search for a tutorial on using UPDATE, and you should be set . Denno
  13. dont use IE7? lol Sorry for the non helpful answer, but I had to say it . Denno
  14. so you need to know how to get the (i'm assuming) multiple choice options from the database, and make them appear next to a radio button?? Is this correct? It will be fairly simple if this is what you need.... Denno
  15. you will need to cleanse the search data, to make sure php doesn't interpret the spaces as anything other than a space. I can't think of the functions of the top of my head, but a simple google search should find something you need. It will convert spaces into &nbsp (I believe). So look into cleansing of input text. Denno
  16. Oh wait, maybe it's because I never took the $ sign out. Damn it lol.
  17. Pikachu2000 can you please explain why this didn't work then? $content .= "/pages/"; $content .= $_GET['$content']; $content .= ".php"; Is it just because of the lack of { } curly brackets? Denno
  18. Just to make sure, you have named the files in the pages folder as one.php and two.php correct?
  19. Alright, so it will depend on where you put the line of code that says include (blah blah).. If you put that line in the php file that is in /phptest then you will need to specify the path to the file which is /pages/page.php. If the include code line is in the default.php file, then you don't say /pages/page.php, as this will look for another folder called pages. You just say page.php (so $_GET["content"] etc etc) I think it's only a path issue that you're having.. I'll continue to try and help . Denno
  20. Ok can you give me a short brief as to what you want to achieve here? Do you want the index page to link to another php page that is in the sub folder pages? Or is the content pulled from a php page and display in the index page? Denno
  21. Wait sorry, I've just realized what's happening there. I probably should have tried to comprehend the code before I suggested anything lol. Try this: $content .= "/pages/"; $content .= $_GET['$content']; $content .= ".php"; That should hopefully work a bit better . You can put them all on the same line if you want, but it's easier to put them on the 3 lines, at least for me . Denno
  22. Try putting double quotes in here: $content .= $_GET["pages/$content"].'.php'; That might help... Denno
  23. Possibly. I don't know how but the results() function is.. Denno
  24. surround the javascript with: <script type="text/javascript"> //function goes here </script Need to tell the browser to read the code as javscript, at the moment it's reading it as php. You will also need to echo it out. Or just escape from php (?>) just before the <script type="text/javascript"> declaration, and then back into php (<?php) afterwards. Denno
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.