Jump to content
ParkerShannon

This is embarassing, but . . .

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

Share this post


Link to post
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);

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...