Results 1 to 5 of 5

Thread: php eror

  1. #1

    Default php eror


    <?php
    include("connection.php"); // connect to database

    mysql_query("INSERT INTO member (username, password, fname, lname,email)
    VALUES ('$_POST[username]', '$_POST[password]', '$_POST[fname]','$_POST[email]' $_POST[lname])")
    or die(mysql_error());

    echo "New Contact Added";
    ?>

    =============================================


    this is registration form

    <form action="adduser.php" method="post"></br>
    UserName <input type="text" name="username"></br>
    Password <input type="text" name="password"></br>
    FirstName<input type="text" name="fname"></br>
    LastName <input type="text" name="lname"></br>
    email <input type="text" name="email"></br>


    <input type="submit">


    eror

    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 '2)' at line 2


    unsay hinungdan ani nga eror?

  2. #2
    PHP Code:
    <?php
    include("connection.php"); // connect to database

    mysql_query("INSERT INTO member (username, password, fname, lname,email) VALUES ('$_POST[username]', '$_POST[password]', '$_POST[fname]','$_POST[email]$_POST[lname])")
    or die(
    mysql_error());

    echo 
    "New Contact Added";
    ?>
    nag.gamit ka ug single quote, inside double-quote... not sure. Para ma.isolate nmo ang error, segregate the query from the comman. Example:
    PHP Code:
    //create the query in a string
    $query "INSERT INTO member(username, password, fname, lname, email) VALUES($_POST['username'], $_POST['password'], $_POST['fname'], $_POST['lname'], $_POST['email]"))

    //execute the query
    mysql_query($query); 
    Last edited by ChaosOrb; 08-20-2013 at 02:50 PM.

  3. #3
    VALUES ('$_POST[username]', '$_POST[password]', '$_POST[fname]','$_POST[email]' $_POST[lname]'

    your error starts 2) kay imong $_POST[lname] wala man ni siya nimo g butangan og comma and single quote

    it should be ,'$_POST[lname]')"). double check lng boss

  4. #4
    Quote Originally Posted by papasilo View Post
    VALUES ('$_POST[username]', '$_POST[password]', '$_POST[fname]','$_POST[email]' $_POST[lname]'

    your error starts 2) kay imong $_POST[lname] wala man ni siya nimo g butangan og comma and single quote

    it should be ,'$_POST[lname]')"). double check lng boss
    sakto ni iya!

  5. #5
    <form action="adduser.php" method="post"></br>
    UserName <input type="text" name="username" value=" -- 1=1"></br>
    Password <input type="text" name="password"></br>
    FirstName<input type="text" name="fname"></br>
    LastName <input type="text" name="lname"></br>
    email <input type="text" name="email"></br>


    <input type="submit">

  6.    Advertisement

Similar Threads

 
  1. Today, I only have Php 20.00 in my pocket.. GAME!
    By ZuperTzai in forum General Discussions
    Replies: 211
    Last Post: 05-03-2020, 01:08 PM
  2. PHP vs ASP?
    By MyGIRBAUD`DotCom in forum Websites & Multimedia
    Replies: 42
    Last Post: 12-08-2005, 07:03 PM
  3. PHP syntax!!!! syntax!!!! Syntaxx!!!! any... any... any
    By dodie in forum Websites & Multimedia
    Replies: 46
    Last Post: 08-19-2005, 03:11 PM
  4. Web programming like PHP, ASP, HTML AND FLASH ANIMATIONS
    By michaxze in forum Websites & Multimedia
    Replies: 10
    Last Post: 07-30-2005, 05:50 AM
  5. Where: Cebu based PHP/MySQL based hosting
    By cmontoya in forum Websites & Multimedia
    Replies: 19
    Last Post: 06-29-2005, 10:15 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
about us
We are the first Cebu Online Media.

iSTORYA.NET is Cebu's Biggest, Southern Philippines' Most Active, and the Philippines' Strongest Online Community!
follow us
#top