[Resolved] SQL Script output results into table

Home Forums Support SQL Script output results into table

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #86651
    Craig Nicholson

    Hi all

    I have been trying for 2 days now after google searching forums and feel this is the best place to put my problem that hopefully someone can help me with

    i am trying to write an sql script to query my database and get the results into a table.

    but it doesn’t seem to work

    the table headings appear but everything from the first <?php tag shows on the screen

    this is my script

    <html>
    <head>
    <title>Last 10 Results</title>
    </head>
    <body>
    <table>
    <thead>
    <tr>
    <td>Property Image</td>
    <td>Property Description</td>
    <td>Availability</td>
    </tr>
    </thead>
    <tbody>
    <?php
    $connect = mysqli_connect(“db567706584.db.1and1.com”, “dbo567706584”, “<i would put password here>”, “db567706584”);
    if (!$connect) {
    die(mysql_error());
    }
    mysql_select_db(“Properties”);
    $results = mysql_query(“SELECT Property Title4HTML,Image Tag FROM Properties,Available WHERE Property Available Flag = Flag AND Property Available Flag = ‘2’”);
    while($row = mysql_fetch_array($results)) {
    ?>
    <tr>
    <td><?php echo $row[‘Property Image’]?></td>
    <td><?php echo $row[‘Property Description’]?></td>
    <td><?php echo $row[‘Availability’]?></td>
    </tr>

    <?php
    }
    ?>
    </tbody>
    </table>
    </body>
    </html>

    does any one know why my results are not coming back?

    thanks for any help

    #86666
    Craig Nicholson

    also to note i have placed this code in the GP Hooks section under wp_head

    <?php
    $host_name = “db567706584.db.1and1.com”;
    $database = “db567706584”;
    $user_name = “dbo567706584”;
    $password = “<the password>”;

    $connect = mysqli_connect($host_name, $user_name, $password, $database);
    if (mysqli_connect_errno())
    {
    echo “Failed to connect to MySQL: ” . mysqli_connect_error();
    }
    ?>

    #86872
    Tom
    Lead Developer
    Lead Developer

    Hmm, I’m not a big MySQL guy, but you should try posting over at stackoverflow: http://stackoverflow.com/

    It’s the best place for code questions and you should have someone answer you pretty quickly.

    Sorry I can’t be more helpful!

    #87904
    Craig Nicholson
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.