SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast
    Join Date
    Oct 2004
    Location
    Philippines
    Posts
    32
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    parse error, unexpected T_STRING

    Hi,

    This is the my error,

    Parse error: parse error, unexpected T_STRING in C:\web\Apds\proc_athlete.php on line 17

    My pro_athlete.php script is,
    <?php
    include("Opendb.php");
    echo $process;
    if ($process=="add")
    {
    $SQL="INSERT INTO basic_info (StudNo, Lname, Fname, Mname, Birthdate)
    VALUES ('".$studID."','".$Lastname."', '".$Firstname."', '".$Midname."', '".$bday."')";
    }
    elseif ($process=="edit")
    {
    $SQL = "UPDATE basic_info SET StudNo='$studID', Lname='$Lastname', Fname='$Firstname', Mname='$Midname', Birthdate='$bday' WHERE StudNo='$studID'";
    }
    elseif ($process=="del")
    {
    $SQL = "DELETE FROM basic_info WHERE StudNo='$studID';
    }
    mysql_select_db("apds") or die("Could not select database");
    $result = mysql_query($SQL) or die("Query failed : " . mysql_error());
    include("main.php");
    ?>

    The line 17 is:
    mysql_select_db("apds") or die("Could not select database");


    My Opendb.php script is:
    <?php
    mysql_connect("localhost","root", "jojo");
    $mySQLdb="apds";
    ?>

    I just canít find what is wrong with line 17. Iím using PHP 4.3.4, WinXP pro, MySQL 4.0.17

    I have used this scripts in other projects and it worked.

    I hope you will find time to give your comments.

    Thanks a lot.

    Jozin

  2. #2
    SitePoint Wizard
    Join Date
    Mar 2004
    Posts
    1,647
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    u have to delete all this rows with mysql_select_db....
    and put just one into your config file for selecting the database name!
    PHP Code:
    <?php
    mysql_connect
    ("localhost","root""jojo");
    mysql_select_db("apds") or die ("im dead");
    ?>
    cheers

  3. #3
    Non-Member St.'s Avatar
    Join Date
    Nov 2004
    Location
    Cloud #9
    Posts
    119
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    $SQL = "DELETE FROM basic_info WHERE StudNo='$studID';

    $SQL = "DELETE FROM basic_info WHERE StudNo='$studID'";

    loose "

  4. #4
    SitePoint Enthusiast
    Join Date
    Oct 2004
    Location
    Philippines
    Posts
    32
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: parse error, unexpected T_STRING

    Hi ST.,

    It worked! I sure am not yet very familiar with PHP syntax.

    Thanks a lot and more power.

    jozin


Bookmarks

Posting Permissions

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