PHP MySQL & Tipster
    We use Tipster3.1 by Twinhelix Design in conjunction with a PHP calendar system called Showlister by Wheatdesign and a MySQL database for our two row calendar. Since the PHP scripting, which calls the PHP variables displayed by tipster from our MySQL database, is curious and may be useful to others who want to integrate tipster with PHP, we include a description of the tricks involved in making it work. This script alternates tips from left to right. An different version which uses an additional database variable for the tip location is also a possibilty. Some familiarity with Tipster & PHP is necessary to understand what follows.

Trick One:
    On your calendar display page you need to query the MySQL database twice: Once for the variables within the entry that contains a link to tipster; and then again for the variables displayed in the tip.

Trick Two:
    The ID number which associates database field entries as belonging to a particular calendar entry within the displayed table must be added in your query list (for us: $the_id) & must be incorporated in your various "TipLayer" calls.
In our case the ID number is $the_show_id.

Trick Three:
    Define a variable within the script for the placement of the tip: in our case we call it $tiploc. (we use static tips: 0 for left & 570 for right & Angus' "tables...for legacy NS4 support").

     And of course you need to include a variable in your database for any tipster entry which might require the use of the possessive apostrophe.

     Our example ::Trick One highlighted ::Trick Two highlighted ::Trick Three highlighted.

$result = mysql_query("$result = mysql_query("select show_id, month, day, year, dayclass, bigday, damon, town, ventag, venclass, venue, venlink, artist_id
from $database_table
where artist_id = '1'
order by year, month, day",$db)
or die_now("Could not select shows");
while($row = mysql_fetch_array($result)) {
$the_id = $row["show_id"];
$the_show_id = $row["show_id"];
$the_month = $row["month"];
$the_day = $row["day"];
$the_year = $row["year"];
$the_dayclass = $row["dayclass"];
$the_bigday = $row["bigday"];
$the_damon = $row["damon"];
$the_town = $row["town"];
$the_ventag = $row["ventag"];
$the_venclass = $row["venclass"];
$the_venue = $row["venue"];
$the_venlink = $row["venlink"];
echo("\t<tr>\n\t\t<td class=" . "$the_dayclass" . "align='center'>" . "$the_bigday" . ", 
" . "$the_damon" . " in " . "$the_town" . "&nbsp;" . "$the_ventag" . "</td>\n\t\t</tr>\n");
echo("\t<tr>\n\t\t<td class=" . " $the_venclass" . "align='center'><A href='$the_venlink' " . "
onmouseover=" . "\"Tip" . "$the_id" . ".show('links')\" onmouseout=" . "\"Tip
" . "$the_id" .".hide()\"
> $the_venue" . "</a></td>\n\t\t</tr>\n");

}
echo("\t</tr></table>\n</div>\n");

$result = mysql_query("select show_id, month, day, year, bigday, damon, town, tipvenue, address, phone, hours, artist_id
from $database_table
where artist_id = '1'
order by year, month, day",$db)
or die_now("Could not select shows");
while($row = mysql_fetch_array($result)) {
$tiploc = "570";
$the_id = $row["show_id"];
$the_show_id = $row["show_id"];
$the_month = $row["month"];
$the_day = $row["day"];
$the_year = $row["year"];
$the_bigday = $row["bigday"];
$the_damon = $row["damon"];
$the_town = $row["town"];
$the_tipvenue = $row["tipvenue"];
$the_address = $row["address"];
$the_phone = $row["phone"];
$the_hours = $row["hours"];

echo("\t</td></tr></table></div>\n");

if ($tiploc == "570") {
$tiploc = "0";
}
elseif ($tiploc == "0") {
$tiploc = "570";


echo("\t\n<div id=\"Tip" . "$the_id" . "Layer\" style=\"position: absolute; z-index: 10000; visibility: hidden;
left: 0px; top: 0px; width: 10px\"> </div>
<script language=\"JavaScript\">
var Tip" . "$the_id" . " = new TipObj('Tip" . "$the_id" . "');with (Tip" . "$the_id" . ")
{ template = '<table bgcolor=\"#dedede\" cellpadding=\"1\" cellspacing=\"0\" width=\"200\" border=\"0\">' +
'<tr><td><table cellpadding=\"1\" cellspacing=\"1\" width=\"100%\" border=\"0\">' +
'<tr><td bgcolor=\"#336699\" align=\"center\" height=\"30\" class=\"tipClass\">%3%</td></tr>' +
'<tr><td bgcolor=\"#aa9933\" align=\"center\" height=\"*\" class=\"tipClass\">%4%</td></tr>' +
'</table></td></tr></table>';doFades = false;
tips.links = new Array('$tiploc', -110, 100,
'" . " $the_tipvenue" . "<BR>" . "$the_address" . "<BR>" . "$the_town" . "<BR>" . "$the_phone" . "',
' <b>" . "$the_bigday" . " " . "$the_damon" . "</b><BR>' +
' <b>" . "$the_hours" . "</b><br />');

tipStick = 0;}</script>\n");
}

echo("\t</tr></table>\n</div>\n");

?>

Top