Jump to content

slider can not include


dgnzcn

Recommended Posts

hi friends,

i shared my slider show file, but can not include it. only slider can not include message showing. all paths and variables is correct for that file.

 

i share screenshoot of my database.

 

can you look please ?

 

 

 



<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }


  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);


  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}


$colname_slider_cek = "-1";
if (isset($_GET['sayfa'])) {
  $colname_slider_cek = $_GET['sayfa'];
}
mysql_select_db($database_dene_test, $dene_test);


$query_slider_cek = sprintf("SELECT * FROM slider_ekle WHERE sayfa = %s ORDER BY sira ASC", GetSQLValueString($colname_slider_cek, "text"));
$slider_cek = mysql_query($query_slider_cek, $dene_test) or die(mysql_error());
$row_slider_cek = mysql_fetch_assoc($slider_cek);
$totalRows_slider_cek = mysql_num_rows($slider_cek);


mysql_select_db($database_dene_test, $dene_test);
$query_Recordset1 = "SELECT * FROM slider ORDER BY foto_sira ASC";
$Recordset1 = mysql_query($query_Recordset1, $dene_test) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
</head>


<body>
<?php 
if($row_slider_cek['slider_name'] == ['LOUVERS']){
include("slider/louvers/louvers.php");
}else{
echo 'slider can not include';
}?>


</body>
</html>
<?php
mysql_free_result($slider_cek);


mysql_free_result($Recordset1);
?>

post-87090-0-58689200-1430392426_thumb.png

Link to comment
https://forums.phpfreaks.com/topic/295978-slider-can-not-include/
Share on other sites

Why have you put brackets around LOUVERS?

if($row_slider_cek['slider_name'] == ['LOUVERS']){

try changing it to

if($row_slider_cek['slider_name'] == 'LOUVERS'){

also, try and make more relevent debuging messages:

}else{

echo 'could not include slider file as $row_slider_cek returned '.$row_slider_cek['slider_name'];

}?>

thanks again. your answer worked forme.

 

i have another problem.

 

repeat region code need work together with main image and THUMBNAIL image. how can i configure it.

 

<div id="wowslider-container1">
    <div class="ws_images">
      <ul>
       <?php do { ?> <li><img src="uploads/<?php echo $row_louvers['foto_dosya']; ?>" alt="1" title="<?php echo $row_louvers['foto_baslik']; ?>" id="wows1_0"/></li>
      </ul>
    </div>
    <div class="ws_bullets">
      <div> 
        
        <a href="#" title="THUMBNAIL"><span> <img src="uploads/<?php echo $row_louvers['foto_dosya']; ?>" alt="1" width="117" height="48"/></span></a>
          <?php } while ($row_louvers = mysql_fetch_assoc($louvers)); ?>
      </div>
    </div>

You should have started a new thread for a different problem.  The issue is that you have not created your while loop properly.  I'm not sure what's supposed to be part of the loop and what isn't, but I have restructured your code and fixed your loop.  look into heredoc statements in order to remove the need to keep bustring in and out of php tags.  this is meant as a guideline, not a plug-in fix. I also added a counter to ensure that you maintain unique IDs for the list items.

$counter = 0;

while ($row_louvers == mysql_fetch_assoc($louvers)){

$loopString = <<<LOOP_STRING

<div id="wowslider-container1">

<div class="ws_images">

<ul>

<li><img src="uploads/{$row_louvers['foto_dosya']}" alt="1" title="{$row_louvers['foto_baslik']}" id="wows1_0-{$counter)"/></li>

</ul>

</div>

    <div class="ws_bullets">

      <div>

        <a href="#" title="THUMBNAIL"><span> <img src="uploads/{$row_louvers['foto_dosya']}" alt="1" width="117" height="48"/></span></a>

    </div>

 </div>

</div>

LOOP_STRING;

$counter++;

echo $loopString;
}

thanks for your reply, but i can not understand what you mean because my english is not good enought. sory for this.

 

here is my codes, if you can edit for work correctly, then i will be say thanks..

<div id="wowslider-container1">


      <div class="ws_images">
        <ul>
            <?php do { ?>  <li><img src="uploads/<?php echo $row_louvers['foto_dosya']; ?>" alt="1" title="<?php echo $row_louvers['foto_baslik']; ?>" id="wows1_0"/></li>
        </ul>
        </div>
      <div class="ws_bullets">
        <div> 
          
          <a href="#" title="THUMBNAIL"><span> <img src="uploads/<?php echo $row_louvers['foto_dosya']; ?>" alt="1" width="117" height="48"/></span></a></div><?php } while ($row_louvers = mysql_fetch_assoc($louvers)); ?>
        </div>   
   
<div class="ws_script" style="position:absolute;left:-99%">
      <div class="ws_shadow"></div>
    </div> 

try this:

 

<?php

$preLoop = <<<PRE_LOOP
<div id="wowslider-container1">
<div class="ws_images">
<ul>
PRE_LOOP;

echo $preLoop

$counter = 0;
while ($row_louvers == mysql_fetch_assoc($louvers)){
$loopString = <<<LOOP_STRING
<li><img src="uploads/{$row_louvers['foto_dosya']}" alt="1" title="{$row_louvers['foto_baslik']}" id="wows1_0-{$counter)"/></li>
    <div class="ws_bullets">
      <div>
        <a href="#" title="THUMBNAIL"><span> <img src="uploads/{$row_louvers['foto_dosya']}" alt="1" width="117" height="48"/></span></a>
    </div>
</div>
LOOP_STRING;
$counter++;
echo $loopString;
};

$postLoop = <<<POST_LOOP
</ul>
</div>
</div>
POST_LOOP;

echo $postLoop;
?>

not working friend. thanks for your reply. i fix like this:

 

<div id="wowslider-container1">


      <div class="ws_images">
        <ul>
          <?php do { ?>
          <li><img src="uploads/<?php echo $row_louvers['foto_dosya']; ?>" alt="1" title="<?php echo $row_louvers['foto_baslik']; ?>" id="wows1_0"/></li>
            <?php } while ($row_louvers = mysql_fetch_assoc($louvers)); ?>
        </ul>
</div>
<div class="ws_bullets">
 <div> 
 <?php do { ?><a href="#" title="<?php echo $row_Recordset1['foto_baslik']; ?>"><span> <img src="uploads/<?php echo $row_Recordset1['foto_dosya']; ?>" alt="1" width="117" height="48"/></span></a><?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
    </div>
    </div>   
   
<div class="ws_script" style="position:absolute;left:-99%">
      <div class="ws_shadow"></div>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.