1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

php not working?

Discussion in 'PHP' started by pshaw, Jan 1, 2021.

  1. #1
    Hi, I just loaded new os (windows7 professional) to my machine along with later version
    of xampp and when I run php files I get php code. I should get a report yet I get the
    result shown below. My file is .php and I am running it through an html file.
    I use firefox. I'm running xampp-win32-7.3.2-0-VC15 although I have tried 2
    other versions. Apache and mysql are running. I could use some advice. thanks!

    here is the code:
    <html><body>
    Certification Expiration Report<p>
    
    <hr>
    <?php
    
    //Open a new connection to the MySQL server
    require_once "hoappsdb-connect.php";
    
    //MySqli Select Query
    $results = $mysqli->query (SELECT * FROM waitlist");
    
    echo "<table border=1>";
    echo "<th>unit#</th>";
    echo "<th>resident name</th>";
    echo "<th>movein date</th>";
    echo "<th>effect date</th>";
    echo "<th>expire date</th>";
    
    echo "</tr>";
    while($row = mysql_fetch_array($result))
    {
    echo "<tr>";
    echo "<td>" . $row['apt'] . "</td>";
    echo "<td>" . $row['name'] . "</td>";
    echo "<td>" . $row['moveindate'] . "</td>";
    echo "<td>" . $row['effdate'] . "</td>";
    echo "<td>" . $row['expdate'] . "</td>";
    
    echo "</tr>";
    }
    echo "</table>";
    
    // Free result set
    mysqli_free_result($result);
    } else{
    echo "No records matching your query were found.";
    }
    } else{
    echo "ERROR: Could not able to execute $sql. " . mysqli_error($link);
    }
    
    // Close connection
    mysqli_close($link);
    ?>
    </body></html>
    
    here is the result:
    
    515 Certification Expiration Report
    06/22/2020 - 06/22/2021
    
    query (SELECT * FROM waitlist"); echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; while($row = mysql_fetch_array($result)) { echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; } echo "
    unit# resident name movein date effect date expire date days left recertification notification
    " . $row['apt'] . " " . $row['name'] . " " . $row['moveindate'] . " " . $row['effdate'] . " " . $row['expdate'] . " " . $row['daysleft'] . " " . $row['90date'] . " " . $row['60date'] . " " . $row['30date'] . "
    "; // Free result set mysqli_free_result($result); } else{ echo "No records matching your query were found."; } } else{ echo "ERROR: Could not able to execute $sql. " . mysqli_error($link); } // Close connection mysqli_close($link); ?>
    Code (markup):
     
    Last edited by a moderator: Jan 4, 2021
    pshaw, Jan 1, 2021 IP
  2. Efetobor Agbontaen

    Efetobor Agbontaen Active Member

    Messages:
    136
    Likes Received:
    41
    Best Answers:
    5
    Trophy Points:
    85
    #2
    First of all, what do you mean by this?
    You should run it through the xampp server. So can you please confirm that your file is in XAMPPs htdocs folder and you are running it via localhost/path/to/file.php in your browser
     
    Efetobor Agbontaen, Jan 1, 2021 IP
  3. JEET

    JEET Notable Member

    Messages:
    3,825
    Likes Received:
    502
    Best Answers:
    19
    Trophy Points:
    265
    #3
    JEET, Jan 2, 2021 IP
  4. pshaw

    pshaw Greenhorn

    Messages:
    90
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
    #4
    I don't understand why after so many years I can't now
     
    pshaw, Jan 3, 2021 IP
  5. JEET

    JEET Notable Member

    Messages:
    3,825
    Likes Received:
    502
    Best Answers:
    19
    Trophy Points:
    265
    #5
    Read the link I posted above, do the solution given in first answer, and it should work.
     
    JEET, Jan 3, 2021 IP
  6. pshaw

    pshaw Greenhorn

    Messages:
    90
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
    #6
    What I meant was I loaded the php file with an html file
     
    pshaw, Jan 26, 2021 IP