Jump to content

kwdelre

Members
  • Posts

    52
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

kwdelre's Achievements

Member

Member (2/5)

0

Reputation

  1. Thank you very much! You guys really helped explain it for me. Guess I just needed to hear it a couple different ways. Thanks again!
  2. I see what you are saying. I originally put this: function CheckCertStatus () { instead of... function CheckCertStatus ($host, $dbusername, $dbpassword, $TxQuizdb, $QuizResultsTable) { thinking that it was necessary because $host, etc was located in another file. So I didn't put it there for the right reason. But based on the code I have in the function, do I need $host, etc in the function declaration? Could you give me a child's explanation of these statements? - $Ready is the only variable that I need to take from the function. - In the function itself there are several variables from an include(). I'm just confused about what will go in: function CheckCertStatus (?) { and when implementing CheckCertStatus (?) Thanks for the help!
  3. Does it matter that some of these variables are from an "include ()" file?
  4. Hey everyone, I'm pretty inexperienced as my code may show. I am trying to clean up my code and organize it better by using a user-defined function. For some reason I can't get it to work though and I'm wondering if there is some code in my function that can't be (i.e. some MySql). I'm sure its something obvious to you all, I just haven't used my own functions before. The screen stays blank with no errors. Thanks for any help. Here is function I am defining. All code inside of the function works perfect until I put it in this function and call it. function CheckCertStatus ($host, $dbusername, $dbpassword, $TxQuizdb, $QuizResultsTable) { mysql_connect($host, $dbusername, $dbpassword); mysql_select_db($TxQuizdb); $QuizVerifyQuery = mysql_query("SELECT Score, Quiz_Name, User_Email, Quiz_Full_Name, Pass FROM ".$QuizResultsTable." WHERE User_Email = '".$_SESSION['Email']."' AND Pass = 'PASSED'"); while($QuizVerify = mysql_fetch_array($QuizVerifyQuery)) { if ($QuizVerify['Quiz_Name'] == "S1") { $S1 = 1; } if ($QuizVerify['Quiz_Name'] == "S2") { $S2 = 1; } if ($QuizVerify['Quiz_Name'] == "P1") { $P1 = 1; } if ($QuizVerify['Quiz_Name'] == "P2") { $P2 = 1; } if ($QuizVerify['Quiz_Name'] == "P3") { $P3 = 1; } if ($QuizVerify['Quiz_Name'] == "M1") { $M1 = 1; } } if (($S1 && $S2 && $P1 && $P2 && $P3 && $M1) == 1) { $Ready = 1; } } Calling it: CheckCertStatus();
  5. Can anyone please help? I am not getting paid for this. I have spent 13 hours now on this stupid validation. PLEASE!
  6. NEVERMIND I got it....I'm such an amateur! Now I have a different question. My form validation works and all but as I'm testing it ($_POST['submit']) is staying true even when I refresh the page. I have to close Safari and reopen it. What can I do to stop this? Is it just because I am using a testing server? I am using Safari because firefox won't display my php pages. and I am using Xampp Thanks!
  7. Hi there, I am working on getting my php form validation working. I just learned why mine wasn't working and it was because I had a header(location) in the middle of the html doc. The reason I had it there was because the code I am using is placed where I want the error to show. Here is the code I am using for this part. I only have one field being validated at the moment. <? session_start(); if ($_POST['submit']) { $_SESSION['City'] = $_POST['City']; $errors = ""; if(!$_SESSION['City']){ $errors = $errors . "Please enter your city<br>"; } if ($errors != "") { echo "Please check the following errors:<br>"; echo $errors; } else { header("Location: nextpage.php"); } } ?> My question is: What way would you reorganize this (scrapy) validation to where I can redirect my user to a new page when there is no error value? The form page submits to itself with POST. Thanks for your help.
  8. I feel the same way. I keep running into deprecated code in the examples I can find through searches. I'm pretty good about being able to find the code to customize what I am doing. But like you mentioned I need the "overall" understanding first. Any sources out there current?
  9. I'm trying to learn how to validate a form using the php server side method. Everything I search is very different and old. Anyone have knowledge of a good tutorial or source that I could use? None of my books have anything about it either! Thanks!
  10. Thanks a lot Pikachu. Go to know for the future.
  11. I wanted to ask you about this syntax. Obviously I'm a beginner In your code response you used acentos around the original field name. In all examples from mysql.dev they use apostrophes. When I went to change your acentos to apostrophes (only to keep consistency) the date was NULL. Does it have to be acentos? Just trying to learn it correctly, thanks for your explanation.
  12. Thank you sir! That worked!
  13. Hey guys. I've tried everything that I can find from searching but still cannot manage to get this to work. I am simply running a SELECT query that is returning a 'date' field. I want to format this date as it is echoed. From all of the different examples I have seen I haven't seen the code in actual working code. Using the code below I get the date printed still but it is still in mysql's format. So here is the last attempt I made. $QuizQuery = mysql_query("SELECT DATE_FORMAT('CURDATE()','%W, %M, %Y') Quiz_id, Score, Quiz_Name, Date_Taken, Pass FROM ".$QuizResultsTable." WHERE User_id = '".$_SESSION['User_id']."' AND Quiz_Name = 'P".$ii."' "); I also tried using the DATE_FORMAT in the originating INSERT query with no result. Thanks for any help!
  14. Was there something I said that isn't the "proper" way to do it? Thanks for the link. I don't have this set up as a form. I would like the user to click on a link and have that recognized by the "quiz detail" page
  15. I have a page that lists out some basic information about each quiz this particular student has taken (call it "quiz summary"). I am creating another page that will have all details of a particular quiz by itself (call it "quiz detail"). If I have a link for each quiz on the "quiz summary" page, how do I tell the "quiz detail' page which link they clicked on? Or which quiz they have selected. I was thinking it would work if I assigned a session variable to each link and then the "quiz detail" page could verify which returns true still and show details for that quiz. Would this logic work? Npot sure how to do it anyone though. thanks for any help!
×
×
  • 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.