Results 1 to 8 of 8

Thread: Please Help me to write a Php code

  1. #1
    Join Date
    Nov 2004
    Location
    United kingdom
    Posts
    20

    Default Please Help me to write a Php code

    Hi, i am new in pHp, i can write how to add data to MySql table and view it by using apace server at my own pc, but when i am going to do the same thing from the web server then its nt working, so i am realy in problem

    Please can anyone write for me a simple code with only 2 fields, how to connect database from web server, how to add data on thpse fields and how to retrive those data.

    my web server address is .fosiul.bizhat.com

    so pls, i would be very greatful, pls help me .

  2. #2
    Join Date
    Sep 2003
    Posts
    3,040

    Default

    To run web server on local computer download and install Apache from

    www.apache.org

    Then you need to download PHP and MySQL and install them.

    www.php.net
    www.mysql.com

    To study PHP, buy a book or search google for PHP tutorials.

    It is very easy to study if you know C Programming.
    Become PHP Expert in 30 days
    FreeMarriage.com - Free Online Matrimonial
    FlashWebHost.com - Professional Web Hosting, Designing.

  3. #3
    Join Date
    Nov 2004
    Location
    United kingdom
    Posts
    20

    Default T Nokia

    Quote Originally Posted by Nokia
    To run web server on local computer download and install Apache from

    www.apache.org

    Then you need to download PHP and MySQL and install them.

    www.php.net
    www.mysql.com

    To study PHP, buy a book or search google for PHP tutorials.

    It is very easy to study if you know C Programming.
    Thanks for your great advice!!!
    i post this message here after trying hard.
    i worte there, i can do it on my own apace server, but when i am trying to do this at Web server, then its not wokring. all example at book at net are based on pc server, but nt real life example.

    like if i insert data to fosiu.bizhat.com , then how to do it
    there must be some change from the desktop server.
    i want to know that.
    anyway, thanks for your reply, let see if anyone can help me on this issue

  4. #4
    Join Date
    Dec 2004
    Posts
    22

    Default

    i have paper about php tutorial, please send email to me???

  5. #5
    Join Date
    Nov 2004
    Location
    NYS
    Posts
    29

    Default

    look up mySql functions in http://www.php.com/quickref.php

    that will give you all the code you need

    then just use a table and form's to submit the information etc...

    gl

  6. #6
    Join Date
    Dec 2004
    Location
    Mel - Aus
    Posts
    34

    Default Ok, here is something simple

    <?php
    //Database user name
    $username = "pee_wee";

    //Database password
    $password = "let_me_in";

    //Leave this as it is
    $hostname = "localhost";

    //Run Connection Script!
    $connect = mysql_connect(
    $hostname, $username, $password)
    or die("Unable to connect to MySQL");

    //Inserting into mysql database
    $query = mysql_query("INSERT INTO `your_table` (`field1`, `field2`) VALUES ('$value1', '$value2')");


    //Close Connection
    mysql_close($connect);

    ?>

    <?php
    //Database user name
    $username = "pee_wee";

    //Database password
    $password = "let_me_in";

    //Leave this as it is
    $hostname = "localhost";

    //Run Connection Script!
    $connect2 = mysql_connect(
    $hostname, $username, $password)
    or die("Unable to connect to MySQL");

    //Getting data - This will dispay all records
    $qe = mysql_fetch_array("select * from `your_table`");
    while($query = mysql_query($qe)) {
    print "Field1: $query[field1]
    ";
    print "Field2: $query[field2]
    ";
    }



    //Close Connection
    mysql_close($connect2);

    ?>

  7. #7
    Join Date
    Oct 2004
    Location
    Malaysia,
    Posts
    321

    Default

    Quote Originally Posted by Black 4C6F747573
    look up mySql functions in http://www.php.com/quickref.php

    that will give you all the code you need

    then just use a table and form's to submit the information etc...

    gl
    broken link, man!!
    Any other links?? :? :!:

  8. #8
    Join Date
    Dec 2004
    Posts
    10

    Default

    You could always just search on google...

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
  •