Michael W.: Mysql - einzelne Daten entnehmen (PHP)

Beitrag lesen

Hallo,

ich habs endlich geschafft eine verbindung zur datenbank und zu den tabellen herzustellen *freu*.

mit folgendem script:
#####################
<?php
$host = 'localhost';
$user = 'xxx';
$pass = 'xxx';
$db = $user;
$table = 'test';
$line = array();

Connecting, selecting database

$link = mysql_connect($host, $user, $pass)
 or die("Could not connect<br>");
mysql_select_db($db, $link)
 or die("Could not select database<br>");

Performing SQL query

$query = "SELECT * FROM $table";
$result = mysql_query($query)
 or die("Query failed<br>");

Printing results in HTML

print "<table>";

while ($line = mysql_fetch_array($result, MYSQL_ASSOC))
{
 print "<tr>";

foreach ($line as $col_value)
 {
  print "<td>$col_value</td>";
 }

print "</tr>";
}

print "</table>";

mysql_close($link);
?>
###################

so! nun gibt mir mein browser die tabelle 'test' aus und die sieht so aus:

70 80 51 52 53
49 50 51 52 53

also quasi so:

----------------------------
  | 1  | 2  | 3  | 4  | 5  |
--|----|----|----|----|----|
A | 70 | 80 | 51 | 52 | 53 |
B | 49 | 50 | 51 | 52 | 53 |
----------------------------

ok! und nun möchte ich aber nicht die ganze tabelle, sondern zb nur a2 oder b5 ...

wie mache ich das?

und noch was:

wie fülle ich die tabelle mit einem formular über PHP?
 a einzeln  (zb a3)
 b mehrfach (zb a3, a4, b1 ...)

Danke
MfG
Michael W.