Script Error but all looks right

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • webandwe
    New Member
    • Oct 2006
    • 142

    Script Error but all looks right

    Hi I got this code from a book.

    I don't know what is going on but everytime i run the script i get this:

    Parse error: syntax error, unexpected '=' in /home/webandwe/public_html/php/install.php on line 19

    I have the lastest mysql and apache stuff. Can someone please tell me what the problem is or if my server is a bit old how to fix it to get around it?

    Kind Regards
    Webandwe

    [PHP]
    <?PHP

    #connect to mysql
    $conn = @mysql_connect( "localhost" , "my database username", "mypass")
    or die ( "could not connect to the database");

    #select the database
    $rs= @mysql_select_d b("webandwe_con tact", $conn)
    or die("Could not select database");

    #create the SQL query
    $query = "id int(4) auto_increment, ";
    $query. = "name varchar(50),";
    $query. = "email varchar(50),";
    $query. = "comments text,"; #*******This is line 19************* *************
    $query. = "time timestamp(14), primary key(id)";

    $sql = "create table guestbook ($query)";

    #execute query

    $rs = @mysql_query ($sql)
    or die ("<h3>Could not create guestbook tables<br/>
    Does it already exist</h3>");

    #confrim the result
    echo("<h3>Creat ed guestbook table</h3>");
    ?>
    [/PHP]
  • ronverdonk
    Recognized Expert Specialist
    • Jul 2006
    • 4259

    #2
    A concatenation is NOT written like '. =' (dot space equals) but like '.=' (dot equals).

    Ronald :cool:

    Comment

    • webandwe
      New Member
      • Oct 2006
      • 142

      #3
      Thanks Ronald -

      Comment

      Working...