Solved

Tooltip for php/mysql

Posted on 2011-02-15
6
1,374 Views
Last Modified: 2013-12-13
Hi all,

I have just converted my html website to php and added a database too it. I am using the same tooltip I used for the old html site and am trying to get it to work with php/mysql.

you can view the website at : ttp://irwells.homeftp.net

I would like the tooltip to get the information from the database to display product name, price and dimenstio etc.

can any help or direct me to a tooltip that work with php/mysql?
 ps im ussing a wz_tooltip
<!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">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 <link rel="stylesheet" href="../css/styleSheet.css" type="text/css" />
 <meta name="robots" content="NOINDEX" />
<head>
    <title>Tables Gallery</title>
</head>

<body>
  <script type="text/javascript" src="../js/wz_tooltip.js"></script>

    <script type="text/javascript" src="../js/functions.js"></script>

    <script type="text/javascript">
    function ToolTip() {
            Tip('<strong>Dimensions:</strong><br />Height 45cm<br />Width 46cm<br />Depth 26cm<br />Weight 4.8KG<br /><br />Click image for more information.', TITLE, <?php $row['product_name']; ?>'title <?php $row['product_name']; ?>', PADDING, 9, STICKY, true, DURATION, 4500, OPACITY, 80, BGCOLOR, '#C5C5C5', BORDERCOLOR, '#343434', FONTCOLOR, '#343434', OFFSETX, 50);
            return false;
        }
    </script>
<!-- Start of Container -->
<div id="container">
<?php
include ('../includes/header.html');
require_once ('../../secure/connect.php');
include ('../includes/mainMenu.php');
?>
    
<!-- Start of Picture viewer -->
<?php
// Retrieve the products information:
$q = "SELECT * FROM `products` INNER JOIN `category` ON products.category_id=category.category_id INNER JOIN `images` ON products.product_id=images.product_id WHERE category_type=\"Tables\" AND print_name=\"main\" ";

//Display results
$r = mysqli_query($mysqli, $q);
if(mysqli_num_rows($r) >=0){
     // Show Results
    $row = mysqli_fetch_array($r, MYSQLI_ASSOC);
    
// Create the form:

//<!-- Main picture display area-->
echo'<div id="picViewer_mainPic">';
 if($row["print_name"] =="")
    {
        echo"<img src=\"../../images/nophoto_large.gif\" onmouseover=\"return prev(this)\" onmouseout=\"UnTip()\"/>";
    }else
        {
        echo'<a href="../products/product.php?id=' . $row['product_id'] . '">';
        echo"<img id='theImg' src=\"../../uploads/".$row['image_name']."\" class=\"display_Image\" onmouseover=\"return prev(this)\" onmouseout=\"UnTip()\"/></a>";
        }
echo'</div>';
//<!-- End of Display Area -->

//<!-- Thumbnail display area -->
echo' <div id="picViewer_Thumbnails">';
echo'   <div id="Div1">';
 if($row["print_name"] =="")
    {
        echo"<img src=\"../../images/nophoto_large.gif\" onmouseover=\"return prev(this)\" onmouseout=\"UnTip()\"/>";
    }else
        {
        echo'<a href="../products/product.php?id=' . $row['product_id'] . '">';
        echo"<img src=\"../../uploads/".$row['image_name']."\" class=\"thumbnail_Portrait\" onmouseover=\"return prev(this)\" onmouseout=\"UnTip()\"/></a>";
        }
echo'   </div>';
        //Thimbnail Images
        while ($row = mysqli_fetch_array($r, MYSQLI_ASSOC)){
        for($i=0; $i < count($row['image_name']); $i++){
            
echo'   <div id="Div2">';
echo'       <a href="../../uploads/' . $row["image_name"] . '"  >';
echo"       <img src=\"../../uploads/".$row["image_name"]."\" class=\"thumbnail_Portrait\" onmouseover=\"return prev(this)\" onmouseout=\"UnTip()\" /></a>";
echo'   </div>';

            if($row = mysqli_fetch_array($r, MYSQLI_ASSOC)){

echo'   <div id="Div1">';
echo'       <a href="../../uploads/' . $row["image_name"] . '"  >';
echo"       <img src=\"../../uploads/".$row["image_name"]."\" class=\"thumbnail_Portrait\" onmouseover=\"return prev(this)\" onmouseout=\"UnTip()\" /></a>";
echo'   </div>';
            }
        }
        }

echo'</div>';
//<!-- End of thumbnail display area -->

}
 mysqli_free_result ($r);
 mysqli_close($mysqli);
 ?>
  <!-- Start of Footer -->
 <div id="footer2"><a href="../index.php">Home</a></div>
</div>
</body>
</html>

Open in new window

0
Comment
Question by:irwells
[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
6 Comments
 
LVL 110

Expert Comment

by:Ray Paseur
ID: 34898856
This might be easiest if you use jQuery.

http://phpmysql.co.in/jquery/tooltip/
http://docs.jquery.com/Plugins/tooltip

In line 17 of your script above, change as shown in the code snippet.
Tip('<strong>Dimensions:</strong><br />Height 45cm<br />Width 46cm<br />Depth 26cm<br />Weight 4.8KG<br /><br />Click image for more information.', TITLE, <?php echo $row['product_name']; ?>'title <?php echo $row['product_name']; ?>', PADDING, 9, STICKY, true, DURATION, 4500, OPACITY, 80, BGCOLOR, '#C5C5C5', BORDERCOLOR, '#343434', FONTCOLOR, '#343434', OFFSETX, 50);

Open in new window

0
 

Accepted Solution

by:
irwells earned 0 total points
ID: 34905712
Thanks for the reply.

I have found the solution by adding the code to my script
<img src=\"../../uploads/".$row["image_name"]."\" class=\"thumbnail_Portrait\" onmouseover=\"Tip('$dimension<br/><br/>Click for more information.', SHADOW, true, TITLE, '$name', PADDING, 9, STICKY, true, DURATION, 4500, OPACITY, 80, BGCOLOR, '#C5C5C5', BORDERCOLOR, '#343434', FONTCOLOR, '#343434', OFFSETX, 50); return prev(this)\" onmouseout=\"UnTip()\" /></a>";

it has sorted the problem.
many Thanks
0
 
LVL 29

Expert Comment

by:fibo
ID: 34936481
Irwells,
you might consider closing this question by saying you have an answer and allocating points to a single answer or several answers, yours included.
0
Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

 
LVL 1

Expert Comment

by:DoCBReeD
ID: 34947970
I've found jquery tools to be very useful: http://flowplayer.org/tools/demos/index.html
0
 

Author Comment

by:irwells
ID: 35358043
The experts apove didn't find the solution I was looking for, after further research I foun the solutiom myself. See notes above
0
 

Author Closing Comment

by:irwells
ID: 35390621
Problem solved by myself
0

Featured Post

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
This article discusses four methods for overlaying images in a container on a web page
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to count occurrences of each item in an array.

622 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