Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How can I query mysql database for javascript tabview?

Posted on 2010-08-27
6
Medium Priority
?
393 Views
Last Modified: 2013-12-13
attached please my source for javascript tabview on php.
distribution.txt
0
Comment
Question by:beckyng
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 5

Expert Comment

by:jijeesh
ID: 33545376
I dont think you can do it from javascript, instead you have to use server side scripting for accessing database.  
0
 
LVL 31

Expert Comment

by:Marco Gasi
ID: 33554192
I've downloaded your file but it is a binary file. Please attach a plain text file to allow me take a look.
Bye
0
 

Author Comment

by:beckyng
ID: 33564729
Pls rename the distribution.txt to distribution.rar

Thanks
0
The top UI technologies you need to be aware of

An important part of the job as a front-end developer is to stay up to date and in contact with new tools, trends and workflows. That’s why you cannot miss this upcoming webinar to explore the latest trends in UI technologies!

 
LVL 31

Accepted Solution

by:
Marco Gasi earned 375 total points
ID: 33564822
If you wish to know how insert in your tab mysql results, look at code snippet below. Keep in mind that in order to view different result in each tab you have only to run different quesry with different names (for tab1 you'll use $sql1 = "SELECT STATEMENT"; $result1 = mysql_query($sql1); and so on.

Hope this helps.
Best regards
<?php
$sql = "SELECT mydata FROM mytable";
$result = mysql_query($sql);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>

<title>Tab-View Sample</title>

<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="description" content="" />
<meta name="keywords"    content="" />

<link rel="stylesheet" type="text/css" href="tab-view.css" />

</head>
<body>

<?php $id = isset($_GET['id']) ? $_GET['id'] : 1; ?>

<div class="TabView" id="TabView">


<!-- ***** Tabs ************************************************************ -->

<div class="Tabs" style="width: 452px;">
  <a <?=($id == 1) ? 'class="Current"' : 'href="sample.php?id=1"';?>>Tab 1</a>
  <a <?=($id == 2) ? 'class="Current"' : 'href="sample.php?id=2"';?>>Tab 2</a>
  <a <?=($id == 3) ? 'class="Current"' : 'href="sample.php?id=3"';?>>Tab 3</a>
</div>


<!-- ***** Pages *********************************************************** -->

<div class="Pages" style="width: 450px; height: 300px;">
  <div class="Page" style="display: <?=($id == 1) ? 'block' : 'none';?>">
      <div class="Pad">
        <?php
            while ($row = mysql_fetch_array($result)){
                echo $row[0]."<br />";
            }
        ?>
      </div>
  </div>
  <div class="Page" style="display: <?=($id == 2) ? 'block' : 'none';?>"><div class="Pad">Page 2</div></div>
  <div class="Page" style="display: <?=($id == 3) ? 'block' : 'none';?>"><div class="Pad">Page 3</div></div>
</div>

</div>

<script type="text/javascript" src="tab-view.js"></script>
<script type="text/javascript">
tabview_initialize('TabView');
</script>

</body>
</html>

Open in new window

0
 

Author Closing Comment

by:beckyng
ID: 33587921
Very useful
0
 
LVL 31

Expert Comment

by:Marco Gasi
ID: 33587973
Sorry, but what you wished to receive to assign an A instead a B? You question is only one row: I couldn't implement a betetr solution with informations you provided... Anyway, thanks for points, I'm happy to helped you.
0

Featured Post

Build and deliver software with DevOps

A digital transformation requires faster time to market, shorter software development lifecycles, and the ability to adapt rapidly to changing customer demands. DevOps provides the solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question