I’m trying to code a tooltip, which uses http://craigsworks.com/projects/simpletip/# simpletip plugin, which returns data via ajax. However, i can’t seem to display the data from 3 tables, which is fetched via the data image, as each image is assigned to it’s own id. as seen below, i need to display all data from the table, but with 3 tables to read from. in my webpage, a php statement will query data from one table for each category, generated by this tooltips. only a round tooltip came out, not even mysql_error(). i need help asap. this is the only site where i seem to get inputs from others.
<?php
define('INCLUDE_CHECK', 1);
require "../connect.php";
if (!$_POST['img'])
die(mysql_error());
$img = mysql_real_escape_string(end(explode('/', $_POST['img'])));
$row = mysql_fetch_assoc(mysql_query("SELECT alcoholic.*, non_alcoholic.*,
non_alcoholic1.* FROM alcoholic INNER JOIN non_alcoholic USING (img) INNER JOIN
non_alcoholic1 USING (img) WHERE img='" . $img . "' "));
if (!$row)
die(mysql_error());
echo '<strong>' . $row['name'] . '</strong>
<p class="descr">' . $row['description'] . '</p>
<strong>price: $' . $row['price'] . '</strong>
<small>Drag it to your shopping<br /> cart to purchase it</small>';
?>
I’m guessing there are three tables with an
imgcolumn? If so, is this what you need?:Edit: When I said update your OP with the new issue I didn’t mean overwrite it, I meant add it underneath so that this answer (and others if there were any) make sense.
Anyway, the problem is that
$row['name'], etc. don’t refer to anything in theSELECTstatement. You need to changealcoholic.*, non_alcoholic.*, non_alcoholic1.*to what it is you’re pulling out, for example:SELECT alcoholic.name, alcoholic.description, alcoholic.price ...