Jump to content

Search the Community

Showing results for tags 'tabbed'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 1 result

  1. Hi, I am trying to create a tabbed image gallery using php and mysql . The following are my table structure. CREATE TABLE IF NOT EXISTS `gallery_category` ( `category_id` int(11) NOT NULL auto_increment, `category_name` text NOT NULL, PRIMARY KEY (`category_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ; CREATE TABLE IF NOT EXISTS `photos` ( `photo_id` int(20) NOT NULL auto_increment, `photo_filename` varchar(25) NOT NULL, `photo_caption` text NOT NULL, `photo_category` bigint(20) NOT NULL, PRIMARY KEY (`photo_id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=56 ; I am tring to create a tabbed gallery like this. <ul class="tabs"> <li><a href="#" rel="view1">gallery1</a></li> <li><a href="#" rel="view2">gallery2</a></li> </ul> <div class="tabcontents"> <div id="view1" class="tabcontent"> Gallery1 images goes here. </div> <div id="view2" class="tabcontent"> Gallery2 images goes here. </div> </div> Here is my code which i am trying to make this work. <ul class="tabs"> <?php $sql = "SELECT * FROM category ORDER BY category_id ASC"; $query = mysql_query($sql); while($row = mysql_fetch_array($query)) { $cid = $row['category_id']; $category_name = $row['category_name']; echo "<li><a href='?catid=".$cid."' rel='view".$cid."'>$category_name</a></li> "; } echo "</ul>"; ?> <div class="tabcontents"> <?php $sql = "SELECT * FROM category ORDER BY category_id ASC"; $query = mysql_query($sql); while($row = mysql_fetch_array($query)) { $catid = $row['category_id']; $category_name = $row['category_name']; $count = $row['COUNT(photo_id)']; echo"<div id='view".$catid."' class='tabcontent'>"; $catid = (int)($_GET['catid']); $sql = "SELECT * FROM gallery_photos WHERE photo_category = $catid ORDER BY photo_id DESC"; $query = mysql_query($sql); while($row = mysql_fetch_array($query)) { $pid = $row['photo_id']; $photo_caption = $row['photo_caption']; $photo_filename = $row['photo_filename']; echo "$photo_caption</br>"; echo "<img src='".$images_dir."/tb_".$row[photo_filename]."' border='0'"; } } ?> </div> </div> The category is displaying correctly (first <ul> </ul> part) but it content display part is not working. Can any one please help me with this.. Thanks, Sam.
×
×
  • 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.