Thread: Query

    #1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2009
    Posts
    22
    Rep Power
    0

    Query


    Hi guys I have the following tables:

    table name:chapters
    chapter_id

    table name:vers
    id
    table name :texto
    text



    What I have now is the following
    Chapter_id Vers text
    1 1 some text
    1 2 some text
    1 3 some text
    2 1 some text
    2 2 some text

    I want to populate all the vers and text contains each chapter .

    PHP Code:
    <?php        $id_libro $_GET['cat'];          $query="SELECT   vers,texto from rv1960 where $id_libro = capitulo";          $result=mysql_query($query);           while($row=mysql_fetch_array($result,MYSQL_ASSOC))          {                $vers=$row['vers'];               $texto =$row['texto'];                echo "<h3>$vers -- $texto</h3><br>";              echo"<p>";          }  ?>
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Mar 2006
    Posts
    2,402
    Rep Power
    1688
    The table names and column names you mention do not match those you use in the query. Can you provide the output from a SHOW CREATE TABLE from each table and specify how the tables are linked (which columsn are the keys between them).
    The moon on the one hand, the dawn on the other:
    The moon is my sister, the dawn is my brother.
    The moon on my left and the dawn on my right.
    My brother, good morning: my sister, good night.
    -- Hilaire Belloc

IMN logo majestic logo threadwatch logo seochat tools logo