Results 1 to 2 of 2

Thread: How to use Blending Image Slide Show Script with PHP/MySQL for img src

  1. #1
    Join Date
    Jan 2011
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default How to use Blending Image Slide Show Script with PHP/MySQL for img src

    Im having some problems getting this to work:

    PHP Code:
    <?php 
    error_reporting 
    (0); 

    // Connects to your Database  
    mysql_connect("localhost""root""") or die(mysql_error()) ;  
    mysql_select_db("travelinit") or die(mysql_error()) ;   

    //Select Query for images from db
    $query="SELECT id, fld_imagename FROM tbl_banner";
    $result mysql_query($query) or die(mysql_error());   

    //Loop to get image names from query
    while($row mysql_fetch_array$result )) 

    //Write image path and names on page - NAMES ARE PULLED FROM DB
    echo "".$row['fld_imagename']. ","?> </br>

    <?php ?>
    then some html code here ... followed by the script where my problem is:

    PHP Code:
    <script language="JavaScript1.1">
    <!--

    //*****************************************
    // Blending Image Slide Show Script- 
    // © Dynamic Drive (www.dynamicdrive.com)
    // For full source code, visit http://www.dynamicdrive.com/
    //*****************************************

    //specify interval between slide (in mili seconds)
    var slidespeed=3000

    //specify images
    var slideimages=new Array(<?php NEED TO HAVE THE MYSQL ARRAY DATA HERE ?>); 

    var imageholder=new Array()
    var ie=document.all
    for (i=0;i<slideimages.length;i++){
    imageholder[i]=new Image()
    imageholder[i].src=slideimages[i]
    }

    function gotoshow(){
    if (newwindow)
    window.open(slidelinks[whichlink])
    else
    window.location=slidelinks[whichlink]
    }

    //-->
    </script>

    need the above line of code code to pull from MYSQL where it says "NEED TO HAVE THE MYSQL ARRAY DATA HERE"

    the original line of code looks like this:

    PHP Code:
    var slideimages=new Array("topbanner/1.jpg","topbanner/2.jpg","topbanner/3.jpg"

    Seen this line of code by: jscheuer1 of DD

    PHP Code:
    fadeimages[0]=[".<?php echo $row_Recordset1['photo1']; ?> ", "", ""]
    have tried doing this but nothing works..

    PHP Code:
    slideimages[0]=[".<?php echo $row['fld_imagename']; ?> ", "", ""]
    please help im no good at javascript yet and want to learn

    thank you
    Mike

  2. #2
    Join Date
    Jul 2010
    Location
    Minnesota
    Posts
    256
    Thanks
    1
    Thanked 21 Times in 21 Posts

    Default

    try this
    PHP Code:
    //Loop to get image names from query
    while($row mysql_fetch_array$result )) 

    //Write image path and names on page - NAMES ARE PULLED FROM DB
    $img[] = $row['fld_imagename'];

    PHP Code:
    <script language="JavaScript1.1">
    <!--

    //*****************************************
    // Blending Image Slide Show Script- 
    // © Dynamic Drive (www.dynamicdrive.com)
    // For full source code, visit http://www.dynamicdrive.com/
    //*****************************************

    //specify interval between slide (in mili seconds)
    var slidespeed=3000

    //specify images
    var slideimages=new Array(
    <? 
    foreach($img as $i)
    {
      echo 
    "\"$i\" ";

    ?>); 

    var imageholder=new Array()
    var ie=document.all
    for (i=0;i<slideimages.length;i++){
    imageholder[i]=new Image()
    imageholder[i].src=slideimages[i]
    }

    function gotoshow(){
    if (newwindow)
    window.open(slidelinks[whichlink])
    else
    window.location=slidelinks[whichlink]
    }

    //-->
    </script>

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •