Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Tooltip for php/mysql

Posted on 2011-02-15
6
Medium Priority
?
1,405 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 111

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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
This article discusses how to implement server side field validation and display customized error messages to the client.
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…
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.
Suggested Courses

916 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