Jump to content

mikesta707

Staff Alumni
  • Posts

    2,965
  • Joined

  • Last visited

Everything posted by mikesta707

  1. you have an extra square bracket around your $row array's key. this \"window.location='/results.php&id=$row['[proposalid']'\" should be \"window.location='/results.php&id=$row['proposalid']'\" Hope that helps! EDIT: another thing, you must escape the single quotes, or concatenate the array entry to the string. \"window.location='/results.php&id=$row[\'proposalid\']'\" or \"window.location='/results.php&id=" . $row['proposalid'] . "'\"
  2. hmm try a print_r on the $row array and see what you get
  3. you can save the file's HTML as a variable, and use the javascript innerHTML method to put the table inside the DIV. but i'm afraid I don't really understand what you want to do
  4. just write a table in there? <? if ( $page_id == "4" ) { ?> <div id="our-services-box"><table><tr><td>I'm a table!</td></tr></table></div> <? } else { ?> <? } ?>
  5. also, a few things I forgot to say. Whenever you would pass the object to a new variable, you need to re-initialize the object. And remember to include the file with the object's class in every page. so for example this wouldn't work: <?php session_start(); include "class.php"; $object = new Class(); $object->function(); $_SESSION['object']=$object; ?> page2.php <?php session_start(); $object = $_SESSION['object']; $object->function(); ?> this would work: <?php include "class.php"; session_start(); $object = new Class(); $object->function(); $_SESSION['object']=$object; ?> page2.php <?php include "class.php"; session_start(); $object = new Class(); $object = $_SESSION['object']; $object->function(); ?> also remember to include the page before you start the session.
  6. how exactly is it not working. the form is submitting to the page cal.php, is that correct?
  7. the mysql_fetch_array and mysql_fetch_assoc functions can get the data from your mySQL resource and turn it into an array fetch array: http://us.php.net/manual/en/function.mysql-fetch-array.php fetch assoc: http://us2.php.net/mysql_fetch_assoc
  8. assuming that your $row array is 1 dimensional, couldn't you just do $query = mysql_query("SELECT * FROM final WHERE `0` = '0'") or die(mysql_error()); while ($row = mysql_fetch_assoc($query )) { echo key($row).'<br />'; }
  9. yep that should be fine. You may want to make sure that you set the session again after you use the object, IE $userinfo = $_SESSION['user']; $userinfo->fname; $userinfo->update(whatever) //other stuff with userinfo $_SESSION['user'] = $userinfo; because variables inside the object may change, and you want to make sure that your session object is up to date. I believe you can also just use the session instead of copying its value to a variable, IE $_SESSION['user']->update();
  10. you can just pass the object as a whole
  11. Oh ok sure. $wrong = array(1, 4, 3, 10);//You will get this from your table, but for simplicities sake $answers = array("16", "25", "88", etc. etc.);// again you will get this from your table //im assuming your answers array is numeric foreach($answers as $key => $value){ if (in_array($key, $wrong)){ $class = "wrong"; } else { $class="correct";//or whatever your right answer class is } echo "<td class=\"$class\">$value</a>";//or whatever you want to output. } this is a basic example. obviously yours will be different, but the basic logic is there
  12. instead of instantiating the object each time (which would make the class kind of worthless in my opinion) you could just make a session to hold the object, and use that whenever you need to do user based actions
  13. ahh ok, So if you have an array of all the answers, you can iterate through that array to display the answers, and then have an array with all the wrong answers, and use the in_array() function to tell whether or not to highlight the text
  14. oh, I wondered why you had that like at the end
  15. you need single quotes around the keys of associate arrays. so this where id='$row[id]' shoule be where id='" . $row['id'] . "' Hope that helps!
  16. ok so it is an array. Again, WRAP YOUR CODE IN CODE TAGS. now before you go into any of the foreach statements, write print_r($_POST['shows_Selected']) and see what it says. You are making sure that you have something selected right?
  17. try using $_POST[] instead of $HTTP_POST_VARS[]
  18. none of those errors have anything to do with the print_r function. it is clear that none of the foreach statements have an array as their supplied argument. It appears that the post data is not an array. post the part of the form that shows the checkboxes. if you only have 1 check box.. then it won't be an array.
  19. ahhh ok. so in your database does it just have the answers, or does it have the answers, and which are wrong and which are right?
  20. there are two sql queries in that code. which one is running the error?
  21. there is a function called print_r(). print_r($media_array); what happens when you run that
  22. well you would have to have a function called wrong that detects if the answer is wrong or not. However you determine if the answer is wrong you would put in that if statement. How do you determine when an answer is wrong?
  23. ... thats not how you wrap code in code tags but whatever... so line 73 is an empty line? I still don't quite understand. Is like 73 the one below where you indicated? ill assume that line 73 is the foreach two lines below where you indicated. do a print_r on the $media_array variable and see what you get
  24. if (wrong($answer)){ $class = "wrong"; } echo "<td class=\"$class\">"; ?
×
×
  • 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.