Jump to content

This is embarassing, but . . .


ParkerShannon

Recommended Posts

WTF is wrong with this php code? I run this and nothing (see below for image of MySQL SQL results).

<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <title>TITLE</title>
    <meta name="author" content="Parker Shannon">
  </head>  <body>
      <!--?php         
// Declare Connection Variables          
        $servername = "mysql408.discountasp.net";    
        $username = "0140496peoplesp";
        $password = "uhuhuhuhuhu";    
        $dbname = "MYSQL5_1014730_peoplespoll";
// Create connection
  $conn = mysqli_connect($servername, $username, $password, $dbname);
    echo "Connected";
// Select items from table
    $row = "SELECT id, issue FROM question WHERE id=1;
    $result = mysqli_query($conn, $row)
   echo "id: " .  $result["id"] .  "Issue: " .  $result["issue"] . ;
// Close database mysqli_close($conn);    
    echo "Disconnected";
        ?>
  </body>

sql.jpg

Link to comment
Share on other sites

You're also missing a semicolon ; at the end of this line:

  $result = mysqli_query($conn, $row) 

It seems like errors are disabled on your server, if you had them enabled the server would tell you exactly on which line the script stopped and why.

While developing, you can add the following code to the beginning of your file to make sure error messages are displayed instead of a blank screen.

<?php
ini_set('display_errors', 1);
error_reporting(E_ALL);

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...