Results 1 to 8 of 8

Thread: ขอคำแนะนำ==php+mysql== insert into table โดยผ่านหน้าจอ windo

  1. #1
    Junior Member
    Join Date
    Dec 2006
    Posts
    0


    ขอคำแนะนำ==php+mysql== insert into table โดยผ่านหน้าจอ windo

    html Code ********
    <HTML>
    <HEAD>
    <TITLE> New Document </TITLE>
    </HEAD>

    <BODY><form action = "submitform.php" method="GET">
    <TABLE>
    <TR>
    <TD>First name</TD>
    <TD><input type="text" name ="fname" size = "25"></TD>
    </TR>
    <TR>
    <TD>Last name</TD>
    <TD><input type = "text" name="lname" size="25"></TD>
    </TR>
    <TR>
    <TD></TD>
    <TD><input type = "submit"></TD>
    </TR>
    </TABLE>
    </form>
    </BODY>
    </HTML>

    php code ************
    <html>
    <body>


    <?php
    $host = "localhost";
    $user = "root";
    $pw = "password";
    $dbname = "dbname";
    $tbname = "tbname";
    // $fname = "Srm";
    // $lname = "Le";

    mysql_connect($host,$user,$pw) or die("ERROR Connection");
    mysql_select_db($dbname)or die("ERROR DB");
    mysql_query ("INSERT INTO '".$tbname."' (fname,lname) VALUES ('".$fname."','".$lname."')");
    echo "First name is ".$fname."
    ";
    echo "Last name is ".$lname."
    ";
    echo "Table name is ".$tbname."
    ";
    echo "Thank you";

    mysql_close();
    ?>


    </body>
    </html>

  2. #2
    Junior Member
    Join Date
    Oct 2002
    Location
    Thailand
    Posts
    0


    Re: ขอคำแนะนำ==php+mysql== insert into table โดยผ่านหน้าจอ w

    ไม่ทราบที่ว่าไม่ได้นี่เป็นยังไงครับ
    connect mysql ไม่ได้หรือยังไง?

  3. #3
    Junior Member
    Join Date
    Oct 2002
    Location
    United States
    Posts
    0


    Re: ขอคำแนะนำ==php+mysql== insert into table โดยผ่านหน้าจอ w

    ครับอันนี้อยากรุ้เหมือนกันว่า connect อะไรไม่ได้ sql หรือ severอะไร
    ช่วยบอก sql ที่ใช้ให้นิดนึงนะครับ

    แล้ว ที่ว่า run ใน explore ไม่ได้ ตรงไหนเอ่ย??? ???

    /me เด๋วขอรองดูก่อนนะครับ

  4. #4


    ถามคุณ RedAnalyzer ได้ไหมครับว่า จะใช้ connect SQL ด้วย php ยังไง
    เผอิญผมมีหนังสือเขาบอกเสร็จสรรพเรียบร้อย แต่ ผม connect ไม่ได้ครับ
    [SIZE=2]ที่ 1 ไม่ไหว ที่ 2 ไม่ขอ เป็นรองไม่รอ ขออยู่คนเดียวตลอดไป[/SIZE]

  5. #5
    Jedi Global Moderator
    Join Date
    Aug 2007
    Location
    Bangkok
    Posts
    136


    ผมเขียน PHP โดยใช้ SQL SERVER 2005 เป็น Database ครับผม พื้นฐานการ Connection ก็เหมือนกันครับผม ส่วนใหญ่ที่ไม่ได้ เพราะเกิดจากการตั้งค่า ที่ SQL SERVER 2005 มากกว่า เช่นใช้ Windows Authentication Mode ทำให้ Connect ไม่ได้ หรือ ไม่ได้ Enable TCP/IP ใน SQL SERVER พรุ่งนี้จะเอา Code มาใส่ไว้ให้ล่ะกันครับ

  6. #6
    Jedi Global Moderator
    Join Date
    Aug 2007
    Location
    Bangkok
    Posts
    136


    [hide=1]<?php
    /***************************************************************************
    * mssql.php
    * -------------------
    * begin : Saturday, Feb 13, 2001
    * copyright :

  7. #7


    mysql_query ("INSERT INTO &#39;".$tbname."&#39; (fname,lname) VALUES (&#39;".$fname."&#39;,&#39;".$lname."&#39");[/b]
    น่าจะเป็นบรรทัดนี้นะ

    mysql_query ("INSERT INTO ".$tbname." (fname,lname) VALUES (&#39;".$fname."&#39;,&#39;".$lname."&#39");[/b]
    ไม่รู้ว่าใช่เปล่านะ น่าจะใช่แหละ

    [img]http://pic.citecclub.org/out.php/i180_microsoftfirefox.jpg[/img]
    [color=#FF0000][SIZE=2]ตัดสินใจลำบาก[/color][/SIZE]

  8. #8
    Junior Member
    Join Date
    Jul 2007
    Posts
    1


    ยืนยันตามท่าน thongDS คับ

Similar Threads

  1. Replies: 5
    Last Post: 07-03-2010, 11:45 PM
  2. Cain & Abel Crack MySQL old_password using Rainbow Table
    By sae in forum Hacking/Cracking's E-book
    Replies: 0
    Last Post: 14-05-2009, 06:41 PM
  3. Replies: 3
    Last Post: 14-09-2007, 08:42 PM
  4. Replies: 1
    Last Post: 06-11-2006, 01:38 AM
  5. Replies: 2
    Last Post: 28-04-2004, 02:44 PM

Members who have read this thread : 0

Actions : (View-Readers)

There are no names to display.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •