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
https://forums.phpfreaks.com/topic/64559-solved-php-mysql-select/
Share on other sites

About the syntax, I can't halp... no enough time right now

 

If you want a syntax highlighter, try using Notepad2 tha can be downloaded from http://sourceforge.net/projects/notepad2/

It's like the windows' notepad but highlight sntaxes very well (I use it and recomend)

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.