• GoDaddy Community
  • Websites + Marketing | Website Builders
  • Websites + Marketing | Website Builders

    cancel
    Showing results for 
    Show  only  | Search instead for 
    Did you mean: 
    Go to solution

    PHP code displaying on webpage

    Hi

    I am trying to connect to my database. I have a connect_file.php file which i call on my website. However for some reason when I try to run the sql code it display on the website. I can't figure out why this is. I have looked the user to make sure it has permission on the database. Also look through the documentation on how to create the connect_file.php. Everything I am seeing looks correct. Does any know why this would be displaying "query($my_sql); if($result = $db->query($my_sql)) { //the query failed, uh-oh :-( die('There was an error running the query [' . $db->error . ']'); } while($row = $result_post->fetch_assoc()) { echo'
    id: ' . $row['cardio_name'] . ''; } mysqli_close($conn); ?> "website error.jpeg

    1 REPLY 1
    Highlighted
    Helper V
    Helper V
    Solution

    Re: PHP code displaying on webpage

    @icewolf0927,

     

    I did not test your code, but is your code working in local or test environment...

    https://www.tutorialspoint.com/php/mysql_select_php.htm

    Please check the above article to fetch data from a database server...

     

    Regards,

     

    Praveen Thomas

    GoDaddy 24/7 Support www.x.co/247support
    ----->NEXIA