����� ��������� ���� �����. php+mySQL. ������ ��� �������.
T1 (id,data,text) - �������
T2 (id,nt1,data text) - ������� �����������-������ � ����
�� ������� ���� ��� ����������, ������� �� ������ ���� ������. ������.
H���� ������� ��� ������ �1 � ���� � �2 ���� �2.nt1=�1.id
�� ������� ��� �������� �1 ��� ����������� �2
����� � �������
$result2 = mysql_query("SELECT * FROM T1 ORDER BY id DESC LIMIT ".$kol." union
select * from T2 where nt1=id, ".$nn);
H� ��� �� ���� ������... 8-(
Vladimir_Vetchinow
... *����� ��� ����� - ���������� �� ����, ��� ������ ���� �� ����.(c)B.���*
21 May 10 12:37, you wrote to All:
VV> ����� ��������� ���� �����. php+mySQL. ������ ��� �������.
VV> T1 (id,data,text) - �������
VV> T2 (id,nt1,data text) - ������� �����������-������ � ����
VV> �� ������� ���� ��� ����������, ������� �� ������ ���� ������. ������.
VV> H���� ������� ��� ������ �1 � ���� � �2 ���� �2.nt1=�1.id
VV> �� ������� ��� �������� �1 ��� ����������� �2
SELECT id AS id1, NULL as id2, data, text FROM T1 UNION SELECT nt1 AS id1, id
AS id2, data, text FROM T2 ORDER BY id1,id2;
�c� ��� 23 2010 00:06, you wrote to me:
VV>> ����� ��������� ���� �����. php+mySQL. ������ ��� �������.
VV>> T1 (id,data,text) - �������
VV>> T2 (id,nt1,data text) - ������� �����������-������ � ����
VV>> �� ������� ���� ��� ����������, ������� �� ������ ���� ������. ������.
VV>> H���� ������� ��� ������ �1 � ���� � �2 ���� �2.nt1=�1.id
VV>> �� ������� ��� �������� �1 ��� ����������� �2
EG> SELECT id AS id1, NULL as id2, data, text FROM T1 UNION SELECT nt1 AS id1,
EG> id AS id2, data, text FROM T2 ORDER BY id1,id2;
������� �� �����. �������� ��� ����� ������.
� ������� ������� ����� ��������
printf ("H�� �������(a):<font color=#FFFF00> %s...
H� ������ �� %s �� ������������� ����������.
����� ����� �������� ��� ��������� ������?
Vladimir_Vetchinow
... *������, ������� ������ ������ ��� �� ������(c)B.���*
��� ��� 24 2010 17:11, I wrote to Egor Glukhov:
EG>> SELECT id AS id1, NULL as id2, data, text FROM T1 UNION SELECT nt1 AS
EG>> id1, id AS id2, data, text FROM T2 ORDER BY id1,id2;
VV> ������� �� �����. �������� ��� ����� ������.
VV> � ������� ������� ����� ��������
VV> printf ("H�� �������(a):<font color=#FFFF00> %s...
VV> H� ������ �� %s �� ������������� ����������.
VV> ����� ����� �������� ��� ��������� ������?
���������� ������� ����� ������:
$result2 = mysql_query("SELECT...
for ($data=array(); $row=mysql_fetch_assoc($result2); $data[]=$row);
echo "<pre>"; print_r($data); echo "</pre>";
������� � �����:
SELECT statements have a different number of columns
� ����� ������� ������, � ����������...
8-(
Vladimir_Vetchinow
... *� �� ���� ��������� ������ ���� �� ����!(c)B.���*
25 May 2010 11:17, you wrote to all:
VV>> H� ������ �� %s �� ������������� ����������.
VV>> ����� ����� �������� ��� ��������� ������?
VV> ���������� ������� ����� ������:
VV> $result2 = mysql_query("SELECT...
VV> for ($data=array(); $row=mysql_fetch_assoc($result2); $data[]=$row);
VV> echo "<pre>"; print_r($data); echo "</pre>";
while ( list[$id1, $id2, $data, $text] = mysql_fetch_row($result) ) {
echo "<pre>".$id1." - ".$id2." - ".$data." - ".$text."</pre>";
}
VV> 8-(
Oleg
... AKA oleg(&)redut.info AKA ICQ 28852595
��p ��� 25 2010 20:14, you wrote to me:
VV>> ���������� ������� ����� ������:
VV>> $result2 = mysql_query("SELECT...
VV>> for ($data=array(); $row=mysql_fetch_assoc($result2); $data[]=$row);
VV>> echo "<pre>"; print_r($data); echo "</pre>";
OR> while ( list[$id1, $id2, $data, $text] = mysql_fetch_row($result) ) {
OR> echo "<pre>".$id1." - ".$id2." - ".$data." - ".$text."</pre>";
OR> }
VV>> 8-(
���� � � ����������� ���������, ���� ���, �� ��������� ��� ��.
��� �� ����� - �� ����������...
������ � �� ��� ������ �������, ������ ����(��� ����� �� �������� ����) � �����
��������� - ������ �� ������ ������� ���� ������, ������ �� ������ ������� ���,
��� �� ������ ��������. ������ �����.
���� ��� ������.
����, ���� ������ �� ������ �� ��� ���������� �������� "H�� �������"
��� ��� �� ��������:
$num_rows = mysql_num_rows($result4);
if ($num_rows<1){
echo "H�� �������";
}
��� ����������� ��������, ������ ���� >0
�������� ������� ������� ������� �����...
Vladimir_Vetchinow
... *��� �� �����, ���� ��������� ������� �����, ��� ������� �� ���(c)B.���*
> ��� ��� �� ��������:
>
> $num_rows = mysql_num_rows($result4);
> if ($num_rows<1){
> echo "H�� �������";
> }
if (!$num_rows)
��� ��� 28 2010 10:44, you wrote to me:
>> ��� ��� �� ��������:
>>
>> $num_rows = mysql_num_rows($result4);
>> if ($num_rows<1){
>> echo "H�� �������";
>> }
D> if (!$num_rows)
�������, ��� ��������.
H�, ����� ��� ������� ���������...
Vladimir_Vetchinow
... *� ��� ������ �� ������. ������ ������� ��������. ��������.(c)B.���*