dgnzcn Posted April 30, 2015 Share Posted April 30, 2015 (edited) 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); ?> Edited April 30, 2015 by dgnzcn Quote Link to comment https://forums.phpfreaks.com/topic/295978-slider-can-not-include/ Share on other sites More sharing options...
Solution Muddy_Funster Posted April 30, 2015 Solution Share Posted April 30, 2015 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']; }?> Quote Link to comment https://forums.phpfreaks.com/topic/295978-slider-can-not-include/#findComment-1510401 Share on other sites More sharing options...
dgnzcn Posted April 30, 2015 Author Share Posted April 30, 2015 wow thanks. working. Quote Link to comment https://forums.phpfreaks.com/topic/295978-slider-can-not-include/#findComment-1510402 Share on other sites More sharing options...
dgnzcn Posted April 30, 2015 Author Share Posted April 30, 2015 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> Quote Link to comment https://forums.phpfreaks.com/topic/295978-slider-can-not-include/#findComment-1510411 Share on other sites More sharing options...
Muddy_Funster Posted April 30, 2015 Share Posted April 30, 2015 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; } Quote Link to comment https://forums.phpfreaks.com/topic/295978-slider-can-not-include/#findComment-1510413 Share on other sites More sharing options...
dgnzcn Posted April 30, 2015 Author Share Posted April 30, 2015 (edited) 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> Edited April 30, 2015 by dgnzcn Quote Link to comment https://forums.phpfreaks.com/topic/295978-slider-can-not-include/#findComment-1510415 Share on other sites More sharing options...
Muddy_Funster Posted April 30, 2015 Share Posted April 30, 2015 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; ?> Quote Link to comment https://forums.phpfreaks.com/topic/295978-slider-can-not-include/#findComment-1510418 Share on other sites More sharing options...
dgnzcn Posted April 30, 2015 Author Share Posted April 30, 2015 thanks again for reply, but giving error message like this: Parse error: syntax error, unexpected '$counter' (T_VARIABLE), expecting ',' or ';' in Quote Link to comment https://forums.phpfreaks.com/topic/295978-slider-can-not-include/#findComment-1510419 Share on other sites More sharing options...
Muddy_Funster Posted April 30, 2015 Share Posted April 30, 2015 that's just because I missed the ; at the line echo $preLoop add one in and see what happens: echo $preLoop; Quote Link to comment https://forums.phpfreaks.com/topic/295978-slider-can-not-include/#findComment-1510420 Share on other sites More sharing options...
dgnzcn Posted April 30, 2015 Author Share Posted April 30, 2015 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> Quote Link to comment https://forums.phpfreaks.com/topic/295978-slider-can-not-include/#findComment-1510421 Share on other sites More sharing options...
Muddy_Funster Posted April 30, 2015 Share Posted April 30, 2015 well as long as it's working, that's what counts. Quote Link to comment https://forums.phpfreaks.com/topic/295978-slider-can-not-include/#findComment-1510424 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.