View Single Post
  #1 (permalink)  
Old 02-21-2008, 08:33 PM
phpforfun's Avatar   
phpforfun phpforfun is offline
Programming God
 
Join Date: Feb 2008
Posts: 743
Last Blog:
Programming "Just a ...
Rep Power: 8
phpforfun will become famous soon enoughphpforfun will become famous soon enough
Default My SQL Noob at work

So I just started MySQL and SQL today, using SQLyog. Pretty cool stuff. Using a tutorial I found online, however im getting an error.. Here is the code.
PHP Code:
<?
    $host        
=    'localhost';
    
$user        =    'root';
    
$pass        =    'password';
    
$database    =    'roscripts';
    
$connect = @mysql_connect $host$user$pass ) ;

    
$sql "SELECT * FROM `articles` WHERE `ID` = " mysql_real_escape_string $_GET['ID'] );

    
mysql_select_db $database$connect );
    if ( @
mysql_query $sql ) )
    {
        
$query mysql_query $sql );
        
$row mysql_fetch_assoc $query );

        echo 
$row['ID'] . '<br />' $row['article_title'] . '<br />' $row['article_content'];
    }
    else {
        die ( 
mysql_error () );
    }
?>
When I put that in the page, I get this error..

Quote:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
Whats the right suntax? I have the latest version of everything, I am using Apache2triad.

Thanks guys!
Reply With Quote

Sponsored Links