Jump to content

[SOLVED] PHP mysql 'select'


d22552000

Recommended Posts

For the life of me I can't figure out what's wrong...

 

function getcombo($ID)
{
$sql = "SELECT * FROM 'roll' WHERE `ID`=" . $ID . "";
$result = mysql_query($sql);

    if (!$result) {
        die('Invalid query: ' . mysql_error());
    } else {
        while ($row = mysql_fetch_assoc($result)) {

            echo "Roll ID: ";
            echo $row['ID'];
            echo "<br /><br />";

            echo $row['combo'];
            echo " = ";

            echo $row['outcome'];
            echo "<br /><br />";

            echo "Date Rolled: ";
            echo $row['when'];
            echo "<br />";

        }
    }
}

 

and when I run this function I get:

 

Parse error: syntax error, unexpected T_STRING in C:\Inetpub\wwwroot\db-roll.php on line 24

 

This points to the line:

 

echo $row['ID'];

 

Please tell me why it isn't working.

 

EDIT: after using this sites syntax highlighter it look slike I forgot to close a quotation on the result string... but I don't see it..?

 

EDIT:  I dont know why, but when I put an extra " at the end of the function it passed -,- thanks for the syntax highlighter.

 

Do you know of any programs that are close to this WITHOUT their automatic preview?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.