Solved

Tooltip for php/mysql

Posted on 2011-02-15
6
1,335 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
6 Comments
 
LVL 108

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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
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…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

911 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now