ich diesen PHP-Code haben:MySql gibt nur 1 Ergebnis in php
$queryGO = "SELECT * from (SELECT g.go as GO, a.gen as Gen, g.descr as Description
FROM geneOntology g, $tabla a where g.go=a.go) resultado
WHERE resultado.go = '$go'";
$result = mysql_query($queryGO, $db);
$items = mysql_affected_rows($db);
$row = mysql_fetch_array($result);
Es baut mich diese Abfrage:
SELECT * from (SELECT g.go as GO, a.gen as Gen, g.descr as Description
FROM geneOntology g, goHuman a where g.go=a.go) resultado
WHERE resultado.go = 'GO:0000012'
In PHP, es gibt nur 1 Punkt (und Reihe) aber wenn ich die Abfrage direkt im Terminal ausführen, wirft es 15 Register:
+------------+--------+----------------------------+
| GO | Gen | Description |
+------------+--------+----------------------------+
| GO:0000012 | APLF | single strand break repair |
| GO:0000012 | APTX | single strand break repair |
| GO:0000012 | E9PIP4 | single strand break repair |
| GO:0000012 | E9PJ82 | single strand break repair |
| GO:0000012 | E9PLZ0 | single strand break repair |
| GO:0000012 | E9PP57 | single strand break repair |
| GO:0000012 | E9PQ18 | single strand break repair |
| GO:0000012 | H0YEW9 | single strand break repair |
| GO:0000012 | LIG4 | single strand break repair |
| GO:0000012 | M0R2N6 | single strand break repair |
| GO:0000012 | Q6ZNB5 | single strand break repair |
| GO:0000012 | SIRT1 | single strand break repair |
| GO:0000012 | TDP1 | single strand break repair |
| GO:0000012 | TNP1 | single strand break repair |
| GO:0000012 | XRCC1 | single strand break repair |
+------------+--------+----------------------------+
15 rows in set (0,04 sec)
Ich kann nicht sehen, was passiert. In der Tat habe ich ähnlichen Code in anderen PHP-Aktion und es führt de Query ok ... Könnten Sie mir helfen?
Vielen Dank im Voraus! Grüße.
@ user3118279 Und wenn Sie zu PDO wechseln, können Sie 'fetchAll()' auch verwenden, um das zu erreichen, was Sie derzeit mit einer API zu erreichen versuchen, die es nicht unterstützt. –
Ok, ich werde es versuchen. Anyway, $ items = mysql_affected_rows ($ db), sollte nicht 15 statt 1 zurückgeben? – user3118279
mysql_affected_rows funktioniert nicht für SELECT-Abfragen, überprüfen Sie die Dokumente. –