Dismiss Notice
You are browsing this site as a guest. It takes 2 minutes to CREATE AN ACCOUNT and less than 1 minute to LOGIN

How to save a php file and html form to input data to MySQL database?

Discussion in 'Tech, Gadgets & Science Forum' started by Mbelwa Germano, May 18, 2012.

  1. Mbelwa Germano

    Mbelwa Germano JF-Expert Member

    #1
    May 18, 2012
    Joined: May 7, 2011
    Messages: 789
    Likes Received: 1
    Trophy Points: 0
    Mkuu Heshima Mbele,

    Mosi:
    Nimejaribu kufanya connection ili kuweza kuingiza information kwenye database kupitia html form using php with a file extension .php (as localhost) bila na mafanikio, hivyo naomba msaada katika hili.

    Pili:
    Naomba msaada wa jinsi ya kupopulate information kwenye webpage pale mtu anapotuma comments kupitia the same webpage.

    Tatu:
    Jinsi ya kuritrive information from the database.

    Nitashukuru kwa msaada wako.
     
  2. Gud guy

    Gud guy Member

    #2
    May 18, 2012
    Joined: Nov 23, 2011
    Messages: 18
    Likes Received: 0
    Trophy Points: 0
    tembelea link hii www.w3schools.com then follow the php link utapata tutorials nzuri sana for beginners, and all your questions will be answed. there are also offline version of the site w3schools, in case ukiihitaji just let me know
     
  3. SamJet

    SamJet Senior Member

    #3
    May 18, 2012
    Joined: Jul 22, 2009
    Messages: 165
    Likes Received: 2
    Trophy Points: 0
    kupopulate ni afadhali utumie Ajax APIs, soma w3school kwa hilo, na PHP/Mysql connection, chek hii,,,

    [h=2]Create a Connection to a MySQL Database[/h]Before you can access data in a database, you must create a connection to the database.
    In PHP, this is done with the mysql_connect() function.
    [h=3]Syntax[/h]mysql_connect(servername,username,password);


    [TABLE="class: reference, width: 1"]
    [TR]
    [TH]Parameter[/TH]
    [TH="width: 80%, bgcolor: #E5EECC, align: left"]Description[/TH]
    [/TR]
    [TR]
    [TD]servername[/TD]
    [TD]Optional. Specifies the server to connect to. Default value is "localhost:3306"[/TD]
    [/TR]
    [TR]
    [TD]username[/TD]
    [TD]Optional. Specifies the username to log in with. Default value is the name of the user that owns the server process[/TD]
    [/TR]
    [TR]
    [TD]password[/TD]
    [TD]Optional. Specifies the password to log in with. Default is ""[/TD]
    [/TR]
    [/TABLE]
    Note: There are more available parameters, but the ones listed above are the most important. Visit our full PHP MySQL Reference for more details.
    [h=3]Example[/h]In the following example we store the connection in a variable ($con) for later use in the script. The "die" part will be executed if the connection fails:
    <?php
    $con = mysql_connect("localhost","peter","abc123");
    if (!$con)
    {
    die('Could not connect: ' . mysql_error());
    }

    // some code
    ?>



    [HR][/HR][h=2]Closing a Connection[/h]The connection will be closed automatically when the script ends. To close the connection before, use the mysql_close() function:
    <?php
    $con = mysql_connect("localhost","peter","abc123");
    if (!$con)
    {
    die('Could not connect: ' . mysql_error());
    }

    // some code

    mysql_close($con);
    ?>




    [HR][/HR][h=2]Altova XMLSpy &#8211;Try the industry's leading XML editor![/h]Whether you're new to XML or already an advanced user, the user-friendly views and powerful entry helpers, wizards, and debuggers in XMLSpy are designed to meet your XML and Web development needs from start to finish.
    Download a fully functional free, 30-day trial!
    [HR][/HR]

    [h=2]Altova® MapForce®
    Graphical XML Conversion Tool from the Developers of XMLSpy®
    [/h][​IMG]
    Need an easy way to get data into XML, or transform XML to another format? MapForce lets you map XML data to/from any combination of XML, database, flat file, Excel 2007, XBRL, or Web services data. Then it transforms data instantly or auto-generates royalty-free code for recurrent conversions. New features in Version 2012!
    [TABLE]
    [TR]
    [TD="align: left"]
    • Easy-to-use, graphical data mapping interface
    • Instant data transformation
    • XSLT 1.0/2.0 and XQuery code generation
    • Java, C#, and C++ code generation
    • Advanced data processing functions
    • Support for all major relational databases including SQL Server, IBM DB2, Oracle, and more
    • Integration with Altova StyleVision for report rendering
    • Visual Studio & Eclipse integration
    • Available in 32-bit and 64-bit versions
    Download a fully-functional trial today!
    [/TD]
    [/TR]
    [/TABLE]

     
Loading...