www.webdeveloper.com
Results 1 to 3 of 3

Thread: Parse error: syntax error, unexpected T_STRING, expecting ',' or ';'

  1. #1
    Join Date
    Jan 2014
    Posts
    27

    Parse error: syntax error, unexpected T_STRING, expecting ',' or ';'

    PHP Code:
    <?php
    $hostname 
    "localhost"
    $username "1104107";
    $password "r940c1";
    $database "db1104107";
    //echo '24';

    //connection to the database
    $dbhandle mysql_connect($hostname$username$password);
    $db mysql_select_db($database$dbhandle)
      or die(
    "Unable to connect to MySQL");
    //echo "Connected to MySQL<br>";

    $query_createTemporaryTable "CREATE TEMPORARY TABLE temp(temp_id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, 
                                                               ArtistName VARCHAR(20), NAME of the DVD VARCHAR(30)"


    $result_createtemptable mysql_query($query_createTemporaryTable ,$dbhandle );
                                                                
    $query_insertintotable "INSERT INTO everything (ArtistName, NAME of the DVD) VALUES ('RIHANNA', 'SHAWSHANK')";

    $result_insertintotable mysql_query($query_insertintotable ,$dbhandle);

    $query_selecttemptable "SELECT ArtistName,NAME of the DVD FROM temp";

    $result_selecttemptable mysql_query$query_selecttemptable,$dbhandle);

    $row_selecttemptable mysql_fetch_array($result_selecttemptable$dbhandle);

    while(
    $row_selecttemptable mysql_fetch_array($result_selecttemptable$dbhandle)){
          echo 
    $row_selecttemptable
          
    or die mysql_error("Try Again");
      }


    ?>
    Error:Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /studhome/0/1104107/public_html/mysql_connect.php on line 33

    I am seriously stuck. I dont know what I am missing.

    Thanks for any help provided.

  2. #2
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,174
    die() is a function, so requires parentheses around its arguments -- though I don't understand the logic of having an "or die()" at that point in the code, since you'll only hit it if the call to mysql_fetch_array() works. For that matter, all the echo will output is the word 'Array' if it gets anything.
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  3. #3
    Join Date
    Jan 2014
    Posts
    27
    Oh, Thanks. It works now and it adds the data to the table. I am really confused about something. Can you tell me if we can create a temporary table by using PHP. Because, I tried to create a TEMP table with php, but i just got the message " temp table not found". Hence, I had to go into phpMyAdmin and create one. If we can create a temp table using PHP. please help.

    Thank you

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles