Jump to content
php.lv forumi

mysql pieprasiijums


sfx

Recommended Posts

Hai all!

Kaa iisti panjemt no mysql resultu ja pieprasiijumu prasu no vairaakaam tabulaam?

 

conn_db();
$query = "SELECT * FROM news1 WHERE id=$id";
$result = mysql_query ($query)
 or die ("Query failed");
while($row=mysql_fetch_row($result)){
...
}

$query = "SELECT * FROM news2 WHERE news1_id=$id";
$result = mysql_query ($query)
 or die ("Query failed");
while($row=mysql_fetch_row($result)){
...
}

 

Man vaig lai es vinju vareetu shaadi izdrukaat :unsure:

 

print("$news1, $news2");

Link to comment
Share on other sites

tur jau driizaak derees

"SELECT * FROM news1 WHERE id=$id UNION SELECT * FROM news2 WHERE news1_id=$id"

tikai, ja news1 un news2 tabulu kolonnu struktuura sakriit,

bet vispaar kas liedz salasiit, veertiibas no pirmaa pieprasiijuma $news1 mainiigajaa, un veertiibas no otrajaa mainiigajaa $news2 un tak tik laimiigi drukaat aaraa. vai tad tas tik sarezhgjiiti daraas, a?

Link to comment
Share on other sites

×
×
  • Create New...