Ask Experts Questions for FREE Help !
Ask
    shihan's Avatar
    shihan Posts: 2, Reputation: 1
    New Member
     
    #1

    May 4, 2009, 05:19 AM
    error in php
    I done a project. I write a following php script and create the mysql database.But I run the php file they show me error. What is the error

    <?php
    $con=mysql_connect("localhost","root");
    if(!$con){
    die('could not connect:'.mysql_error());
    }

    mysql_select_db("project",$con);

    $sql="INSERT INTO customer(firstname)
    VALUES ('$_POST[firstname]')";

    if(!mysql_query($sql,$con));
    {
    die('Error.'.mysql_error());
    }

    echo"1 record added";
    mysql_close($con)

    ?>
    melissagirl's Avatar
    melissagirl Posts: 3, Reputation: 1
    New Member
     
    #2

    Jul 18, 2009, 02:18 AM
    In the line:
    Echo"1 record added";

    Try adding a space between the word 'echo' and the quotation mark. If that's not it, please post the actual error message output by the PHP. If it doesn't set the error, try adding in:
    Error_reporting(E_ALL);

    So that it displays all errors.
    rlerne's Avatar
    rlerne Posts: 10, Reputation: 1
    New Member
     
    #3

    Oct 22, 2011, 10:42 PM
    The last line of your code reads:

    Mysql_close($con)

    It should read:

    mysql_close($con);

    You're close, just missing a semicolon is all :)

Not your question? Ask your question View similar questions

 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.


Check out some similar questions!

IE printing error: res://ieframe.dll/preview.dlg error [ 15 Answers ]

I have seen about a dozen posts on different Web sites regarding this error. The most common fixes are related to an individual work station. We are experiencing this problem with our Web site and everyone accessing it is unable to print pages that are within frames. I tried the fixes on my...

Oracle Error 12560:tns Protocol Adapter Error [ 3 Answers ]

Hi, Whenever I try to log in using SCOTT/TIGER userid, I get the error "ORA ERROR 12560:TNS PROTOCOL ADAPTER ERROR". I tried starting the listener from administration-> services, but still the problem persists. Can you please suggest a solution?

Printing Error-Script Error [ 1 Answers ]

When I try to print a window pops up: Internet Explorer Script Error Line:1174 I have tried several things: Quick Restore, checked Script debugging box.


View more questions Search