Results 1 to 2 of 2

Thread: SQL & PHP problem

  1. #1
    Join Date
    Sep 2005
    Location
    Bogota, Colombia
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default SQL & PHP problem

    Hello.
    I have a problem.
    How i can show in the page an specify id of a SQL table.
    {Perdon por mi ingles}

  2. #2
    Join Date
    Apr 2006
    Posts
    190
    Thanks
    3
    Thanked 7 Times in 7 Posts

    Default

    try this:

    Code:
    <?
    //connect to mysql
    //change user and password to your mySQL name and password
    mysql_connect("localhost","user","password"); 
    	
    //select which database you want to edit
    mysql_select_db("news"); 
    
    //select the table
    $result = mysql_query("select * from news");
    
    //grab all the content
    while($r=mysql_fetch_array($result))
    {	
       //the format is $variable = $r["nameofmysqlcolumn"];
       //modify these to match your mysql table columns
      
       $title=$r["title"];
       $message=$r["message"];
       $who=$r["who"];
       $date=$r["date"];
       $time=$r["time"];
       $id=$r["id"];
       
       //display the row
       echo "$title <br> $message <br> $who <br> $date | $time <br>";
    }
    ?>

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
  •