Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2006
    Location
    Baltimore, Maryland.. It's a big place you won't be able to find me!
    Posts
    15

    Unanswered: Help with t_string error in this line

    Hello all,

    I trying to get this code to work, however I am getting a t_string error.

    I am using this to write a script to to access a mysql database. This is just an experiment at this point.

    By the way is you cannot tell I am a total newbie at this.

    here is the code:


    <?php

    $dbhost='localhost';
    $dbuser='jkaskel';
    $dbpass='tasha1';
    $dbname='bfcc';

    $conn=mysql_connect($dbhost, $dbuser, $dbpass);



    mysql_select_db($dbname);


    $username = $_POST['username'];
    $firstname = $_post['firstname'];
    $lastname = $_post['lastname'];
    $companycode = $_post['companycode'];
    $businesscode = $_post['businesscode'];


    $strsql = "insert into 'users' (username,password,firstname,lastname,companycode, businesscode) values
    ('jkaskel','joe','kaskel','tasha1','bfcc','bldr')"


    mysql_query($strsql)
    mysql_close();

    ?>

    The line mysql_query($strsql) is what is throwing the parse error.


    Also why I am at it I had a .php file that had a "submit button" in it and when I clicked the submit button the form would only refresh. I had the action attribute of the form set to point to 'action="newuserquery.php".

    When I clicked the submit button on the form in the .php file the browser would go to this in the address bar

    "http://localhost/newuserinput.php/newuserquery.php" and the 'newuserinput.php' page would refresh itself.

    I am probably rambling at this point. But just one more thing.

    when I changed the newuserinput to an html extention the submit button worked properly.

    Does this make sense?

    Any help would be appreciated!!

    Thanks

    Joe

  2. #2
    Join Date
    Mar 2006
    Location
    Baltimore, Maryland.. It's a big place you won't be able to find me!
    Posts
    15
    Opps one more thing.

    I added the semi colon to the mysql_query line and it still did not work.

    Thanks

    Joe

  3. #3
    Join Date
    Apr 2005
    Location
    Baltimore, MD
    Posts
    297
    You were missing a few semicolons. And you should capitalize POST.

    PHP Code:
    <?php

    $dbhost
    ='localhost';
    $dbuser='jkaskel';
    $dbpass='tasha1';
    $dbname='bfcc';

    $conn=mysql_connect($dbhost$dbuser$dbpass);

    mysql_select_db($dbname);

    $username $_POST['username'];
    $firstname $_POST['firstname'];
    $lastname $_POST['lastname'];
    $companycode $_POST['companycode'];
    $businesscode $_post['businesscode'];

    $strsql "insert into 'users' (username,password,firstname,lastname,companycode, businesscode) values ('jkaskel','joe','kaskel','tasha1','bfcc','bldr')";

    mysql_query($strsql);
    mysql_close();

    ?>
    Give a man a fish and you feed him for a day. Teach a man to fish and you lose a steady customer.
    -----------
    Eclectic Web Development (under heavy construction)

  4. #4
    Join Date
    Mar 2006
    Location
    Baltimore, Maryland.. It's a big place you won't be able to find me!
    Posts
    15
    Thank you so much.

    Those semi colons are nasty little buggers!

    Joe

Posting Permissions

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