Jump to content

Search the Community

Showing results for tags 'logical errors'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 1 result

  1. I am temporarily including some extra "testing" code within my program to help me troubleshoot it. It won't be in the final program. I'm trying to compare the correct answer in a quiz program ($ans) with the user's answer ($_POST['guess']). Even when the user picks the right answer, the program still spits out, "wrong!" I am not seeing my logical error here, but I obviously have one. I attached a screen shot of the output. I hope it helps. Thank you all. if (isset($_POST['qid'])){ //qid is the question id $_SESSION['qid']=$_POST['qid']; print_r($_SESSION); $ans = $db->query("SELECT answer FROM QuestionsAnswers WHERE questionid = " . $_SESSION['qid']); echo "<br />"; print_r ($ans); //correct answer while($row = $ans->fetch(PDO::FETCH_ASSOC)) { echo "<p>Here is my Thursday 6pm attempt:xxx" . intval($row['answer']) . "xxx</p>"; echo "<p>User guessed:xxx" . intval($_POST['guess']) . "xxx</p>"; echo '<p>the extra exes ("xxx") are to demonstrate there are no spaces in the field data.</p>'; } if (intval($row['answer']) == intval($_POST['guess'])){ //values converted to integers just in case one or both is/are a string echo "<p>Right!</p>";} else{ echo "<p>wrong!</p>"; } It is bugging me that PHPFreaks won't let me log into my regular account. Cool. At least I can log in using Facebook. Different account, same person. It is still me. Thanks to all for any help with this one. (please see attached output.)
×
×
  • 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.