Closed Thread
Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: plz help!

  1. #1
    Join Date
    Aug 2009
    Location
    England
    Posts
    23
    Rep Power
    0

    plz help!

    hey peepz i have a problem. ok so i was trying this tutorial
    Code:
    (forum.codecall.net/php-tutorials/13410-register-upload-photo-have-new-page-each-user-after-registration.html)
    i got the tables just fine but when i try the 'regmee2' part (procedure i think) it doesnt work it keeps saying (error 1064 syntax error) or something along those lines. someone pls help me?

    ps i had to put link to tut in code box because of my post count.

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Location
    Advertising world
    Posts
    Many

     
  3. #2
    Join Date
    Aug 2009
    Location
    England
    Posts
    23
    Rep Power
    0

    Re: plz help!

    anyone plz, its so frustrating

  4. #3
    Join Date
    Aug 2009
    Location
    ~/
    Posts
    918
    Rep Power
    19

    Re: plz help!

    Quote Originally Posted by niko619 View Post
    anyone plz, its so frustrating
    Hi niko619,
    When debugging, be patient and look over the code carefully.

    It looks like you've identified the problem area.
    Look at your insert queries carefully!!
    You have 3 tables images, users and user_images.
    You have 3 insert queries, look close at the table names your trying to insert to.

    Now you see it, don't you...
    The table name is users not dbo_users

    If a schema/user was being used then dbo.users would
    be the syntax, but your not using a schema ref. in the
    other insert queries so stick to just users and hopefully
    it's not a reserved word.

    Most important, when something doesn't work...
    Start breaking it down into simpler expressions until it works,
    then build it back up.

    Good Luck fellow forum newbie!!
    joined about the same time

  5. #4
    Join Date
    Aug 2009
    Location
    England
    Posts
    23
    Rep Power
    0

    Re: plz help!

    hey thanx for the reply. ive tried what you said still same syntax error, ive had to change my semicolons to comas for the procedure to get past the 1st part. i have changed all names to what i thought they should be, and its always the same error on the same line. (error below)

    Code:
    #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'insert into users (user_name,password,firstname,lastname,email) values
    (user_na' at line 6

  6. #5
    Join Date
    Aug 2009
    Location
    ~/
    Posts
    918
    Rep Power
    19

    Re: plz help!

    Then you should break it down...
    Drop the stored procedure and run 3 individual queries directly.
    It's late, work with you tomorrow if you don't have it resolved by then.

  7. #6
    Join Date
    Aug 2009
    Location
    ~/
    Posts
    918
    Rep Power
    19

    Re: plz help!

    Hi niko,
    Any progress?

    If your still having a problem, post all the code so I can take a look.
    We'll fix it, php w/ MySQL is very straightforward.

    At work now, but I'll have time at home later.

    Hang in there...
    but NOT by the neck!!

  8. #7
    Join Date
    Aug 2009
    Location
    England
    Posts
    23
    Rep Power
    0

    Re: plz help!

    Quote Originally Posted by debtboy View Post
    Hi niko,
    Any progress?

    Hang in there...
    but NOT by the neck!!
    lol thanx. im trying php query's at the moment. getting error still but trying to fix it. fingers crossed. i will post later and tell you if i have succeeded or failed lol.

  9. #8
    Join Date
    Aug 2009
    Location
    ~/
    Posts
    918
    Rep Power
    19

    Re: plz help!

    Hope you succeeded, if not
    post everything and we'll find the problem

  10. #9
    Join Date
    Aug 2009
    Location
    England
    Posts
    23
    Rep Power
    0

    Re: plz help!

    k ive tried doing the procedure from php still same line but i get this error instead
    Code:
    Parse error: syntax error, unexpected T_STRING
    always this code
    Code:
    CREATE DEFINER=`root`@`localhost` PROCEDURE  `forum`.`regmee2`(img2 varchar(200), usrnme varchar(20), psswrd varchar(50), frstnme varchar(50),lstnme varchar(50),email varchar(255))
    then i tried the query insert and it comes up with "query was empty"
    this is the code
    Code:
    $query mysql_query ("INSERT INTO images (image_url) values (img2)");
    $query mysql_query ("INSERT INTO users ('$user_name/$file','$user_name','$password','$firstname','$lastname','$email')");
    $query mysql_query ("INSERT INTO user_images (user_id ,image_id )");
    $result =mysql_query ($query,$conn) or die (mysql_error()); 
    i think its what it should be but remember im a noob lol

  11. #10
    Join Date
    Aug 2009
    Location
    ~/
    Posts
    918
    Rep Power
    19

    Re: plz help!

    OK niko,
    I can't debug without seeing all your code,
    so here I made an example that will work
    with your forum database and the users table.

    Call up data_input.php
    fill in the boxes and submit
    then data_input_script.php will insert your entries into the database

    If your successful, then you can build back up to 3 queries, etc...
    GOOD LUCK!!

    your current database name: forum
    current table name and description: users
    user_id int(10) NOT NULL AUTO_INCREMENT, (primary key)
    user_name - varchar(20) DEFAULT NULL,
    password - varchar(50) DEFAULT NULL,
    firstname - varchar(50) DEFAULT NULL,
    lastname - varchar(50) DEFAULT NULL,
    bad - tinyint(1) DEFAULT NULL,
    email - varchar(255) DEFAULT NULL,
    role_id - int(10) DEFAULT NULL,




    put this in a file named data_input.php
    Code:
    <?php
    
    echo "<html>";
    echo "<body>";
    echo "<form action='data_input_script.php' method='post'>";
    echo "<br />User Name: <input type='text' name='input_name' size='20' maxlength='20' /><br />";
    echo "<br />Password: <input type='text' name='input_password' size='50' maxlength='50' /><br />";
    echo "<br />First Name: <input type='text' name='input_first' size='50' maxlength='50' /><br />";
    echo "<br />Last Name: <input type='text' name='input_last' size='50' maxlength='50' /><br />";
    echo "<br />Email: <input type='text' name='input_email' size='255' maxlength='255' /><br />";
    echo "<br /><br />";
    echo "<br /><input type='submit' />";
    echo "</form>";
    echo "</body>";
    echo "</html>";
    
    ?>
    fill in your password at $passwordname = " " and put this
    code in a file named data_input_script.php
    Code:
    <?php
    
    $databasename = "forum";
    $hostname = "localhost";
    $username = "root"
    $passwordname = "your_password"
    
    
      //OPEN MYSQL CONNECTION
      $connectionname = mysql_connect($hostname, $username, $passwordname) or die ("Unable to Connect");
    
      //SELECT DATABASE
      mysql_select_db($databasename, $connectionname) or die ("Unreachable Database");
    
      //QUERY
      $queryname = "INSERT INTO users
      (user_name,
      password,
      firstname,
      lastname,
      email)
      VALUES
      ('$_POST[input_name]',
      '$_POST[input_password]',
      '$_POST[input_first]',
      '$_POST[input_last]',
      '$_POST[input_email]')
    
      //EXECUTE QUERY
      mysql_query($queryname, $connectionname);
    
      //CLOSE CONNECTION
      mysql_close($connectionname);
    
      print("Record Inserted");
    
    ?>
    Don't build a released internet site with this structure,
    you need to hide the database connection info
    in a directory ABOVE the public one, but for testing
    this structure is easily understood.
    Last edited by debtboy; 09-01-2009 at 11:48 PM.

Closed Thread
Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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