Armenian Knowledge Base  

Go Back   Armenian Knowledge Base > Technical sections > Webmaster Zone > Web Development
Register

Reply
 
LinkBack Thread Tools
Old 09.12.2005, 19:53   #1
полюбому йес эм...
 
Mesrop's Avatar
 
Join Date: 02 2005
Location: near the computer
Age: 26
Posts: 3,243
Downloads: 3
Uploads: 0
Reputation: 129 | 3
Default mysql_num_rows() Problem

hi! chto mne delat'?
script em grel, LOCAL-is vra (MySQL 3.23.53-max-nt)normal a. bayc serveri vra (MySQL 4.0.25-standard) es errorn a talis...

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/mesrop/public_html/script.php on line 15


et toxer@ hamapatasxanum en es hatvaci meji cod-in...
PHP Code:
mysql_connect("localhost""mesrop_user""pass");
mysql_select_db("mesrop_db");
$query="select name, hamar from ".$lng;
$res=mysql_query($query);
echo 
$table.$tr.$td_head._from.$td_end.$td_head._to.$td_end."<form name=form action=main.php method=get>";
$q=$tr.$td_res."<select name=from>";
  
$num=mysql_num_rows($res);
  for (
$i=0$i<$num$i++)
  {
  
$row=mysql_fetch_array($res);
$q=$q."<option value=".$row[1].">".$row[0]."</option>"
}
$q=$q."</select>".$td_end
please. help me....
Reply With Quote
Old 09.12.2005, 21:14   #2
Banned
 
Forever Child's Avatar
 
Join Date: 10 2001
Location: ...осень колибри
Age: 37
Posts: 7,487
Downloads: 0
Uploads: 0
Reputation: 0 | 0
Default Re: mysql_num_rows() Problem

Может быть так, что запрос ничего не выдает?

Попробуй написать так
$res=mysql_query($query) or die("MySQL query '" . $query . "' failed");
Reply With Quote
Old 09.12.2005, 21:23   #3
Какое небо, *, Багдад!
 
knightmare's Avatar
 
Join Date: 10 2005
Location: Ереван
Posts: 1,682
Downloads: 16
Uploads: 0
Reputation: 99 | 3
Default Re: mysql_num_rows() Problem

Скорее всего не та таблица и/или остальная часть запроса, вот и результат не "ресурс", а код возврата обработанного запроса.
2Forever Child: не видел поста
Reply With Quote
Old 10.12.2005, 10:58   #4
полюбому йес эм...
 
Mesrop's Avatar
 
Join Date: 02 2005
Location: near the computer
Age: 26
Posts: 3,243
Downloads: 3
Uploads: 0
Reputation: 129 | 3
Default Ответ: mysql_num_rows() Problem

PHP Code:
<? 
$l
=0;
  if(
$l==0)$lng="street";
    elseif(
$l==1)$lng="arm";    
    else 
$lng="eng";
    
mysql_connect("localhost""mesrop_user""pass");
mysql_select_db("mesrop_db");
$query="select name, hamar from ".$lng;
$res=mysql_query($query) or die("MySQL query '" $query "' failed");
echo 
$table.$tr.$td_head._from.$td_end.$td_head._to.$td_end."<form name=form action=main.php method=get>";
$q=$tr.$td_res."<select name=from>";
  
$num=mysql_num_rows($res);
  for (
$i=0$i<$num$i++)
  {
  
$row=mysql_fetch_array($res);
$q=$q."<option value=".$row[1].">".$row[0]."</option>"
}
$q=$q."</select>".$td_end;
echo 
$q;


$query="select name, hamar from ".$lng;
$res=mysql_query($query);
$q1=$td_res."<select name=to>";
  
$num=mysql_num_rows($res);
  for (
$i=0$i<$num$i++)
  {
  
$row=mysql_fetch_array($res);
$q1=$q1."<option value=".$row[1].">".$row[0]."</option>"
}
$q1=$q1."</select>".$td_end.$tr_end.$tr.$td."&nbsp;".$td_end.$td_res_r."<input type=submit value="._find.">".$td_end;
echo 
$q1;
echo 
"</form>";
 
?>
hesa et amjoxch fail@. serveri vra error a talis, locali vra chotki a...
himael gruma MySQL query 'select name, hamar from street' failed
esqani mej inchna sxal?
Reply With Quote
Old 10.12.2005, 11:07   #5
полюбому йес эм...
 
Mesrop's Avatar
 
Join Date: 02 2005
Location: near the computer
Age: 26
Posts: 3,243
Downloads: 3
Uploads: 0
Reputation: 129 | 3
Default Ответ: mysql_num_rows() Problem

lav. lav. dzeci! shat mersi Forever Child ev knightmare !

$query="select name, hamar from ".$lng;
phoxeci
$query="select name, hamar from street";
ashxatec...
bayc chgitem xi nenc cher ashxatum... meka nenc phophoxakan@ tvel ei...
amen depqum mersi!
Reply With Quote
Old 18.12.2005, 09:54   #6
Вечный Студент
 
Leo's Avatar
 
Join Date: 10 2003
Location: Armenia
Age: 36
Posts: 69
Downloads: 0
Uploads: 0
Reputation: 0 | 0
Default Re: Ответ: mysql_num_rows() Problem

Harmar e ogtagorcel:
$res=mysql_query($query) or die(mysql_error());
Miangamic erevum e zaprosi sxal'.
Udachi.
Reply With Quote
Old 01.02.2006, 09:05   #7
полюбому йес эм...
 
Mesrop's Avatar
 
Join Date: 02 2005
Location: near the computer
Age: 26
Posts: 3,243
Downloads: 3
Uploads: 0
Reputation: 129 | 3
Default Ответ: mysql_num_rows() Problem

Еще один вопрос...
inchpes kareli e MySQL -ic, hanem text -i mi mas@.
aysinqn ete TEXT -@ 100 simvol uni, indz ta 20 simvol@...
mekel pliz, aseq te vortexa drvum et parametr@...
im mot queryn senca
Code:
select TEXT from `news` order by `id` desc
Reply With Quote
Old 01.02.2006, 11:32   #8
Борец с бояном
 
Sauron's Avatar
 
Join Date: 06 2003
Location: Yerevan
Age: 38
Posts: 21,482
Downloads: 1
Uploads: 0
Reputation: 65 | 7
Default Re: Ответ: mysql_num_rows() Problem

Quote:
Originally Posted by mesrop
Еще один вопрос...
inchpes kareli e MySQL -ic, hanem text -i mi mas@.
aysinqn ete TEXT -@ 100 simvol uni, indz ta 20 simvol@...
mekel pliz, aseq te vortexa drvum et parametr@...
im mot queryn senca
Code:
select TEXT from `news` order by `id` desc
select substring(TEXT,1,20) as TEXT from `news` order by `id` desc
Reply With Quote
Old 01.02.2006, 16:46   #9
полюбому йес эм...
 
Mesrop's Avatar
 
Join Date: 02 2005
Location: near the computer
Age: 26
Posts: 3,243
Downloads: 3
Uploads: 0
Reputation: 129 | 3
Default Ответ: mysql_num_rows() Problem

Огромное спасибо!
Reply With Quote
Old 01.02.2006, 19:45   #10
F'(x)=g(x)
 
KarenN's Avatar
 
Join Date: 07 2005
Location: Mi te klinem
Age: 26
Posts: 4,145
Downloads: 2
Uploads: 0
Reputation: 16 | 3
Default Re: mysql_num_rows() Problem

ara mesrop du baci Problem neric urish ban chunes inch sarcum es PROLEM bar@ mech@ anpakasa
Reply With Quote
Old 02.02.2006, 05:26   #11
Борец с бояном
 
Sauron's Avatar
 
Join Date: 06 2003
Location: Yerevan
Age: 38
Posts: 21,482
Downloads: 1
Uploads: 0
Reputation: 65 | 7
Default Re: Ответ: mysql_num_rows() Problem

Quote:
Originally Posted by mesrop
Огромное спасибо!
Да незачто
Reply With Quote
Sponsored Links
Reply

Thread Tools


На правах рекламы:
реклама

All times are GMT. The time now is 16:57.


Powered by vBulletin® Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.