krisis32 Posted February 27, 2010 Report Share Posted February 27, 2010 Pasaku jau iepreikš: No DB saprotu tikpat daudz cik no Ķīniešu valodas! Datubāzē man ir koamandas: ID:1 REZ|UTT|KOMANDA ID:1 REZ|UTT|KOMANDA2 Man vaig kaut kā uztaisīt, lai izvelk tikai KOMANDA spēles, un tās kuras ir tajā pašā ID. Pats šitik tālu esmu ticis: <?php $con = mysql_connect("localhost","DB_USERNAME","DB_PAROLE"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("DB", $con); $result = mysql_query("SELECT * FROM ------ where id in (1) and team = 'KOMANDA'"); echo "<table border='1'> <tr> <th>Komanda</th> <th>Rezultāts</th> <th>Metieni</th> </tr>"; while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row['team'] . "</td>"; echo "<td>" . $row['rez'] . "</td>"; echo "<td>" . $row['Shoot'] . "</td>"; echo "</tr>"; } echo "</table>"; mysql_close($con); ?> Man viņš izvelk tikai KOMANDAS infu. Ja lieku noteiktu ID, tad izvelk tikai to ID! Kā jau minēju no DB ļoti maz saprotu! Paldies jau iepriekš! Quote Link to comment Share on other sites More sharing options...
bubu Posted February 27, 2010 Report Share Posted February 27, 2010 AND vietā liec OR. AND nozīmē loģisko un - t.i. ka uz ierakstu jāizpildās abiem nosacījumiem vienlaicīgi, lai tas izvilktos. OR nozīmē loģisko vai - t.i. jāizpildās ir tikai vismaz vienam no abiem nosacījumiem. Quote Link to comment Share on other sites More sharing options...
krisis32 Posted February 27, 2010 Author Report Share Posted February 27, 2010 (edited) Nu ja, bet kaa lai uztaisa lai izvelk tikai KOMANDAS speeles?!? nevis ID1 un pēctam tikai KOMANDAS REZ utt Ar to OR man nekas nemainijaas! Jo KOMANDAS vs KOMANDA2 ir viens ID nevis katram savs! Un man vaig izvilkt tos konkreetos ID kur ir KOMANDAS speeles pret kaadu citu KOMANDU Edited February 27, 2010 by krisis32 Quote Link to comment Share on other sites More sharing options...
bubu Posted February 27, 2010 Report Share Posted February 27, 2010 Nesaprotu ko tev tur vajag izvilkt. Tev vajag izvilkt tos ierakstus, kuru id tu zini, bet komandu nezini? SELECT * FROM ... WHERE id = $id AND komanda <> '$komanda' Quote Link to comment Share on other sites More sharing options...
krisis32 Posted February 27, 2010 Author Report Share Posted February 27, 2010 Paldies, varat slēgt! Konsultējos ar savu DB GURU! Quote Link to comment Share on other sites More sharing options...
bubu Posted February 27, 2010 Report Share Posted February 27, 2010 Nevis varat slēgt, bet pasaki risinājumu savai problēmai. Forums tāpēc jau ir forums, ka te ir daudz dalībnieki, un ja ne tev, tad kādam citam nākotnē šis topiks var palīdzēt atrisināt arī viņa problēmu. Quote Link to comment Share on other sites More sharing options...
krisis32 Posted February 27, 2010 Author Report Share Posted February 27, 2010 Kods ko pirku ir jaaliek šeit? Quote Link to comment Share on other sites More sharing options...
2easy Posted February 27, 2010 Report Share Posted February 27, 2010 jaa, protams Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.