puting sql result into textarea

Discussion in 'PHP' started by dourvas, Dec 25, 2008.

  1. #1
    hallo there.

    i am new in programming so i ask for your understanding

    i want to put the results from a sql query into a textarea. then i want to be able to pick one of the records of textarea and delete it (textarea and database).

    something is not right. this is my code

    echo "<form method=post name=f2 action='dd-delete.php'>";

    $qry="SELECT id, member, math, bathmos FROM bathmoi";
    echo '<textarea name="show" rows="20" cols="70" readonly="readonly">';

    while($result = mysql_fetch_array($qry)) {
    echo "$result[id], $resuld[memeber], $result[mathima]";
    }
    echo "</textarea>";

    echo "<input type=submit value=Submit>";
    echo "</form>";

    i receive:
    <br />
    <b>Warning</b>: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in <b>C:\xampp\htdocs\admin\drop_down\dd.php</b> on line <b>118</b><br />

    can u help me? what should i do to see the records and be able to pick one of then in order to delete it (database and textarea)?
     
    dourvas, Dec 25, 2008 IP
  2. Dman91

    Dman91 Peon

    Messages:
    46
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Replace
    $qry="SELECT id, member, math, bathmos FROM bathmoi"; with
    mysql_query("SELECT id, member, math, bathmos FROM bathmoi") or die(mysql_error());
    This will tell you what the error is.
     
    Dman91, Dec 25, 2008 IP
  3. farad

    farad Peon

    Messages:
    55
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    <?php
    
    $qry = mysql_quert("SELECT id, member, math, bathmos FROM bathmoi");
    
    while($result = mysql_fetch_array($qry)) {
    $id = $result['id'];
    $member = $result['member'];
    $mathima = $result['mathima'];
    }
    
    echo "<form method=POST name=f2 action=dd-delete.php>";
    echo "<textarea name=show rows=20 cols=70 readonly>";
    echo $id, $member, $mathima;
    echo "</textarea>";
    echo "<input type=submit value=Submit">";
    echo "</form>";
    
    ?>
    PHP:
     
    farad, Dec 25, 2008 IP