Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> problem z $max=mysql_num_rows($results)/2;, Przeniosłem stronę i pojawił się błąd
radek_czerwinski
post
Post #1





Grupa: Zarejestrowani
Postów: 3
Pomógł: 0
Dołączył: 8.02.2010

Ostrzeżenie: (0%)
-----


Witam mam następujący problem.
Przeniosłem stronę na inny serwer. Zaimportowałem starą bazę danych. I zmodyfikowałem plik config.php

Przy próbie wywołania strony pojawia się komunikat:
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/almag/ftp/testy/projekty_lista.php3 on line 53

skrypt wygląda następująco:
  1. <?php
  2.  
  3. require "config.php";
  4. ####### polaczenie do bazy ##################
  5. mysql_connect($myhostname,$my_mysql_userid,$my_mysql_password);
  6. mysql_select_db($my_mysql_database);
  7.  
  8. $query_1="select * from mytkowskiprojekty where typ=$act and powierzchnia='$pow' order by kolejnosc";
  9.  
  10.  
  11. ######### wczytanie htmli ###################
  12. $fd=fopen("html/projekty_lista.htm", "r");
  13. $pal="";
  14. while (!feof($fd)) {
  15. $buffer = fgets($fd, 4096);
  16. $pal=$pal.$buffer;
  17. }
  18. fclose($fd);
  19.  
  20. $fd=fopen("menu_left_projekty.php3", "r");
  21. $menu="";
  22. while (!feof($fd)) {
  23. $buffer = fgets($fd, 4096);
  24. $menu=$menu.$buffer;
  25. }
  26. fclose($fd);
  27.  
  28. $fd=fopen("menu_down.php3", "r");
  29. $stopka="";
  30. while (!feof($fd)) {
  31. $buffer = fgets($fd, 4096);
  32. $stopka=$stopka.$buffer;
  33. }
  34. fclose($fd);
  35.  
  36.  
  37. $fd=fopen("menu_meta.php3", "r");
  38. $meta="";
  39. while (!feof($fd)) {
  40. $buffer = fgets($fd, 4096);
  41. $meta=$meta.$buffer;
  42. }
  43. fclose($fd);
  44.  
  45.  
  46.  
  47. if (ereg("<!--start_news-->(.*)<!--end_news-->", $pal, $tab_l)) $tab_l=$tab_l[1];
  48.  
  49.  
  50. ########## Linki ##################
  51. $lista="";
  52. $results = mysql_query($query_1);
  53. $max=mysql_num_rows($results)/2;
  54. for ($row=0;$row <$max;$row++) {
  55. $result = mysql_fetch_row($results);
  56. $wst = $tab_l;
  57. $wst = str_replace("-id-",$result[0], $wst);
  58. $wst = str_replace("-projekt-",$result[1], $wst);
  59.  
  60. if ($result[2]!=''){
  61. $nazwa=$result[2];
  62. $wst= ereg_replace("-picture-", "<img src=\"projekty/$nazwa\" border=\"0\">", $wst);
  63. }
  64. else{
  65. $wst= ereg_replace("-picture-", "", $wst);
  66. }
  67.  
  68. $result = mysql_fetch_row($results);
  69. $wst = str_replace("-id1-",$result[0], $wst);
  70. $wst = str_replace("-projekt1-",$result[1], $wst);
  71. if ($result[2]!=''){
  72. $nazwa=$result[2];
  73. $wst= ereg_replace("-picture1-", "<img src=\"projekty/$nazwa\" border=\"0\">", $wst);
  74. }
  75. else{
  76. $wst= ereg_replace("-picture1-", "", $wst);
  77. }
  78. $lista.=$wst;
  79.  
  80.  
  81. }
  82.  
  83.  
  84. $pal = ereg_replace("<!--start_news-->(.*)<!--end_news-->", $lista, $pal);
  85. if ($act==1)
  86. $pal= str_replace("-typ-","parterowe", $pal);
  87. else
  88. $pal= str_replace("-typ-","piętrowe", $pal);
  89.  
  90. if($pow==1) $p="od 100 do 120 m2";
  91. if($pow==2) $p="od 120 do 150 m2";
  92. if($pow==3) $p="od 150 do 200 m2";
  93. if($pow==4) $p="powyżej 200 m2";
  94.  
  95. $pal= str_replace("-pow1-",$p, $pal);
  96. $pal= str_replace("-title-",$p, $pal);
  97. $pal= str_replace("-keywords-",$p, $pal);
  98.  
  99. $pal= str_replace("-pow-",$pow, $pal);
  100. $pal= str_replace("-menu-",$menu, $pal);
  101. $pal= str_replace("-stopka-",$stopka, $pal);
  102. $pal= str_replace("-meta-",$meta, $pal);
  103.  
  104. echo $pal;
  105.  
  106. ?>


Nie ukrywam że nie ja napisałem ten skrypt jest on napisany w php3 a na nowym serwerze nie ma interpretera php3 jest php5 ale wydaje mi się że wpis
$max=mysql_num_rows($results)/2; który znajduje się w wierszu 53 nie powinien się różnić.
Pozdrawiam i liczę na odpowiedź.
Pomocy
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 3.10.2025 - 06:54