hello, I have a problem : What is it?

Warning: Unable to jump to row 0 on MySQL result index 2 in c:\apache\htdocs\cd_shop\funkcie_s_databazou.php on line 899

10 Years
Discussion Span
Last Post by stalk

this is code, which display basket of online shop. And I need give to var: $cd details of product which process function vyber_detaily_tovaru($EAN_kod); Thanks for your help

 foreach ($kosik as $EAN_kod => $qty)
    $cd = vyber_detaily_cd($EAN_kod);
    $ciste = vyber_detaily_media($EAN_kod);
    echo "<tr>";
    if($obrazky ==true)
      echo "<td align = left>";
      if (file_exists("obrazky/albumy/".$EAN_kod.".gif"))
         $size = GetImageSize("obrazky/albumy/".$EAN_kod.".gif");
         if($size[0]>0 && $size[1]>0)
           echo "<img src=\"obrazky/albumy/".$EAN_kod.".gif\" border=0 ";
           echo "width = ". $size[0]/2 ." height = " .$size[1]/2 . ">";
         echo "&nbsp;";
      echo "</td>";
      echo "<td align = left>";
    echo "<a href = \"zobrazenie_cd.php?EAN_kod=".$EAN_kod."\">".$cd["album"]."</a> by ".$cd["interpret"];
    echo "</td><td align = center>".number_format($cd["cena"], 2)." Sk";
    echo "</td><td align = center>";

    //ak povolime zmeny, pocet kusov danej polozky sa bude nachadzat v textboxe
    if ($zmena == true)
      echo "<input type = text name = \"$EAN_kod\" value = $qty size = 3>";
      echo $qty;
    echo "</td><td align = center>".number_format($cd["cena"]*$qty, 2)." Sk</td></tr>\n";

  //zobrazenie riadku z celkovou cenou
  echo "<tr>
          <th colspan = ". (2+$obrazky) ." bgcolor=\"green\">&nbsp;</td>
          <th align = center bgcolor=\"green\">$polozky</th>
          <th align = center bgcolor=\"green\">".number_format($celkova_cena, 2)." Sk</th></tr>";

  //zobrazenie tlacitka ulozit zmeny
  if($zmena == true)
    echo "<tr>
            <td colspan = ". (2+$obrazky) .">&nbsp;</td>
            <td align = center>
              <input type = \"hidden\" name = \"uloz\" value = \"true\">  
              <input type = image src = \"obrazky/ulozzmeny.png\" 
                     border = 0 alt = \"Uložit zmeny\">
  echo "</form></table>";

this is code of function: vyber_detaily_tovaru($EAN_kod);

function vyber_detaily_tovaru($EAN_kod)
//funkcia ziskavajuca z databazy detaily konkretneho tovaru podla EAN kodu
  //poziadavka pre databazu o konkretne detaily tovaru 
  if (!$EAN_kod || $EAN_kod=="")
     return false;

   $conn = db_connect();

$query="select * from albumy left join ciste_media on albumy.EAN_kod=ciste_media.EAN_kod where albumy.EAN_kod='$EAN_kod' and ciste_media.EAN_kod='$EAN_kod'";

//   $query = "select * from ciste_media where EAN_kod='$EAN_kod'";
   $result = @mysql_query($query);
   if (!$result)
     return false;
   $result = @mysql_fetch_array($result);
   return $result;

Edited by mike_2000_17: Fixed formatting


Is it possible to make this operation? $musica = vyber_detaily_cd($EAN_kod);
$ciste = vyber_detaily_media($EAN_kod);

How I join this variable? $ musica and $ ciste to one variable: $cd ? function vyber_detaily_cd and vyber_detaily_media($EAN_kod) select details of product which is in database and I need display this detail in shop basket when is used only one variable $cd. So I must join it to one variable $cd.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.