fork download
  1. <?php
  2. //Uses JQuery Carousel-PikaChoose
  3.  
  4. //Connect to database
  5. $db=mysql_connect($dbhost, $dbuser, $dbpass) or die
  6. ('Cant connect to the database because: ') . mysql_error();
  7.  
  8. //Select the database
  9. mysql_select_db($dbname);
  10. $i=0;
  11. //If a category is chosen by user, then display carousel with that categorie's specifics, else display all categories
  12. if($sentprodcat)
  13. {
  14.  
  15. ?>
  16. <script language="javascript">
  17. alert('in first one, but not working... sentprodcat = <?= $sentprodcat ?>');
  18. </script>
  19. <?php
  20.  
  21. $resultPRODNAME=mysql_query("SELECT * FROM products WHERE product_category=\"$sentprodcat\" GROUP BY product_sales_class_name LIMIT 9");
  22.  
  23. $mynumprodname=mysql_num_rows($resultPRODNAME);
  24.  
  25. $myprodcatimage=mysql_escape_string($rowPRODNAME['product_category_image_path']);
  26. $myprodcatsumm=mysql_escape_string($rowPRODNAME['product_category_summary']);
  27.  
  28. if($mynumprodname>0)
  29. {
  30. echo "<div><ul>";
  31.  
  32. while($rowPRODNAME=mysql_fetch_array($resultPRODNAME))
  33. {
  34. for ($i=0; $i<=3;$i++)
  35. {
  36. $myprodname=mysql_escape_string($rowPRODNAME['product_sales_class_name']);
  37. $myprodnameimage=$rowPRODNAME['product_sales_class_name_image_path'];
  38. $myprodnamesumm=mysql_escape_string($rowPRODNAME['product_sales_class_summary']);
  39.  
  40. $myprodcatimage = file_exists($myprodcatimage) ? $myprodcatimage : "images/mb_placeholder.jpg";
  41.  
  42. echo "<li>
  43. <a title=\"$myprodname\" href=\"products_name_display.php?myprodcat=$sentprodcat
  44. &amp;myprodcatimage=$myprodcatimage
  45. &amp;myprodcatsumm=$myprodcatsumm
  46. &amp;myprodname=$myprodname
  47. &amp;myprodnamesumm=$myprodnamesumm
  48. &amp;myprodnameimage=$myprodnameimage\">
  49. <img alt=\"$myprodname\" src=\"$myprodnameimage\" height=\"125\" width=\"125\" />
  50. </a>
  51. <span class=\"centersmallblackcaption\">$myprodname ... $i</span>
  52. <br /><br />
  53. <span class=\"centersmallblack\">$myprodsumm</span>
  54. </li>";
  55. }
  56. }
  57. echo "</ul></div>";
  58. }
  59. else
  60. {
  61. echo "No list items exist";
  62. }
  63. }
  64. else
  65. {
  66. $resultPRODCAT=mysql_query("SELECT * FROM products GROUP BY product_category");
  67.  
  68. $mynumprodcat=mysql_num_rows($resultPRODCAT);
  69.  
  70. if($mynumprodcat>0)
  71. {
  72. echo "<div><table><tr>";
  73.  
  74. while($rowPRODCAT=mysql_fetch_array($resultPRODCAT))
  75. {
  76.  
  77. $myprodcat=mysql_escape_string($rowPRODCAT['product_category']);
  78. $myprodcatimage=$rowPRODCAT['product_category_image_path'];
  79. $myprodcatsumm=mysql_escape_string($rowPRODCAT['product_category_summary']);
  80.  
  81. $myprodcatimage = file_exists($myprodcatimage) ? $myprodcatimage : "images/mb_placeholder.jpg";
  82. //$myprodcatsumm = strstr($myprodcatsumm, "&#46;", true) ? strstr($myprodcatsumm, "&#46;", true): "Meadow Burke - Innovating Concrete Construction.";
  83. ?>
  84. <script language="javascript">
  85. alert('$myprodcatsumm= <?= $myprodcatsumm ?>');
  86. </script>
  87. <?php
  88. $test=strpos(($myprodcatsumm, "&#46;");
  89. ?>
  90. <script language="javascript">
  91. alert('test= <?= $test ?>');
  92. </script>
  93. <?php
  94. if(strpos($myprodcatsumm, "&#46;")>0)
  95. {
  96. $myprodcatsumm = strstr($myprodcatsumm, "&#46;", true);
  97. }
  98. else
  99. {
  100. $myprodcatsumm = "Meadow Burke - Innovating Concrete Construction.";
  101. }
  102.  
  103. echo "<td>
  104. <a title=\"$myprodcat\" href=\"products_cat_display.php?myprodcat=$sentprodcat
  105. &amp;myprodcatimage=$myprodcatimage
  106. &amp;myprodcatsumm=$myprodcatsumm\">
  107. <img alt=\"$myprodcat\" src=\"$myprodcatimage\" height=\"125\" width=\"125\" />
  108. <br />
  109. <span class=\"centersmallblackcaption\">$myprodcat</span>
  110. <br />
  111. <span class=\"centersmallblack\">$myprodcatsumm</span>
  112. </a>
  113. </td>";
  114. $i++;
  115. if ($i % 3 == 0)
  116. {
  117. //we have reached the mid-point, let's create a 2nd row
  118. echo "</tr><tr>";
  119. }
  120. }
  121. echo "</tr></table></div>";
  122. }
  123. else
  124. {
  125. echo "No list items exist";
  126. }
  127. }
  128. ?>
  129.  
Runtime error #stdin #stdout 0.02s 13664KB
stdin
Standard input is empty
stdout
Parse error: syntax error, unexpected ',' in /home/fvRy37/prog.php on line 88