Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I am attempting to create a table using Notepad ++ and when opening on the local root I am receiving the error message:

Parse error: syntax error, unexpected '$query' (T_VARIABLE) in C:\xampp\htdocs\COP3718\caller_call_record_test.php on line 10

I am very new to this and am running into errors left and right that I can not figure out. Here is the code I am inputting:

<?php
//connect to the database - and create the caller_info table
include("inc_connect_local.php");
echo "Connected to mysql";

//Open the testproject database

mysql_select_db("testproject")
//create "caller_call_record" table
$query = "CREATE TABLE caller_call_record(
call_record_id int(11) not null,
Call_Description varchar(50),
franchise_id int(10) not null,
Email varchar(40) not null, 
Username varchar(25) primary key not null)
";
mysql_query($query);

echo "Table created successfully.";
?>
share|improve this question

closed as off-topic by Jakub, mc10, Devolus, Ingo Karkat, Bobby Dec 9 '13 at 8:32

This question appears to be off-topic. The users who voted to close gave these specific reasons:

  • "Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist" – Jakub, Ingo Karkat, Bobby
  • "Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance." – mc10, Devolus
If this question can be reworded to fit the rules in the help center, please edit the question.

    
You need to clarify this edit, if it was just a typo. –  Lion Dec 9 '13 at 4:25
    
go for some reference on php errors .stackoverflow.com/questions/12769982/… –  Rajeev Ranjan Dec 9 '13 at 4:26
add comment

2 Answers

up vote 1 down vote accepted

You have missed to add ; in some lines. such as mysql_select_db("testproject") and mysql_query($query)

    <?php
    //connect to the database - and create the caller_info table
    include("inc_connect_local.php");
    echo "Connected to mysql";

    //Open the testproject database

    mysql_select_db("testproject");
    //create "caller_call_record" table
    $query = "CREATE TABLE caller_call_record(
    call_record_id int(11) not null,
    Call_Description varchar(50),
    franchise_id int(10) not null,
    Email varchar(40) not null, 
    Username varchar(25) primary key not null)
    ";
    mysql_query($query);

    echo "Table created successfully.";
    ?>
share|improve this answer
add comment

you are missing a semi colon in mysql_query($query). It should be mysql_query($query);

share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.