Welcome to Discuss Everything Forums...

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed.


 

Reply to Thread

Post a reply to the thread: help me to fix my error in php.... thanks?

Your Message

Click here to log in

What is the sum of 36 and 12

 
 

You may choose an icon for your message from this list

Additional Options

  • Will turn www.example.com into [URL]http://www.example.com[/URL].

Rate Thread

You may rate this thread from 1-star (Terrible) to 5-stars (Excellent) if you wish to do so.

Topic Review (Newest First)

  • 01-21-2013, 07:50 PM
    touchdown

    help me to fix my error in php.... thanks?

    here's my error:
    Use of undefined constant id

    help me to fix my error thanks in advance

    heres my code

    <?php
    $host="localhost"; // Host name
    $username="root"; // Mysql username
    $password="121"; // Mysql password
    $db_name="accounts"; // Database name
    //$tbl_name="users"; // Table name

    // Connect to server and select database.
    mysql_connect("$host", "$username", "$password")or die("cannot connect");
    mysql_select_db("$db_name")or die("cannot select DB");


    $show = "SELECT * FROM users";
    $result = mysql_query($show);

    while ($show = mysql_fetch_array($result))
    {

    $feild1=$show[id];
    $feild2=$show[username];
    $feild3=$show[password];
    $feild4=$show[name];
    $feild5=$show[date];

    echo "id: $feild1<br>";
    echo "username: $feild2<br>";
    echo "password: $feild3<br>";
    echo "name: $feild4<br>";
    echo "date: $feild5<br>";
    }

    ?>

Posting Permissions

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