Hi noobie here.
I have a motorcross website that amongst other things shows race reports. The site is a static size so I am trying to fit a flash scrolling textbox to show the reports without them spilling outside the website.
I can call a report from the MySQL db with flash and php if I hard code the search variables into the flash (championship, track and date) but I create a list of race reports dynamically from the db and when someone clicks the link I need the race report associated from the link to show up and not a hard coded one.
if that dont make sense(which it probably wont, heres my code)
original php file
<?
require("connect.php");
$count=$_REQUEST['count'];
if($count=='')
{
$count=0;
}
$sql="SELECT * FROM report ORDER BY mid(date1,7,4) DESC, mid(date1,4,2) DESC, mid(date1,1,2) DESC";
$rs=mysql_query($sql);
$num=mysql_num_rows($rs);
while ($count<$num)
{
$championship=mysql_result($rs,$count,"championship");
$track=mysql_result($rs,$count,"track");
$date1=mysql_result($rs,$count,"date1");
$rep1=mysql_result($rs,$count,"rep1");
$rep_desc=substr($rep1,0,150);
$by=mysql_result($rs,$count,"user");
$list="<a href='index.php?mode=full_report&championship=".$championship."&track=".$track."&date1=".$date1."'>".$championship." : ".$track."</a>";
$sql1="SELECT * FROM images WHERE championship = '$championship' AND track = '$track' AND date1 = '$date1' ";
$rs1=mysql_query($sql1);
$num1=mysql_num_rows($rs1);
$i=0;
if($num1>=1)
{
while ($i<$num1)
{
$image=mysql_result($rs1,0,'image');
$imagefill="<img src='/motorcross-news/images/mximages/thumb/".$image."' alt='' />";
$i++;
}
}
else
{
$imagefill='';
}
?>
<div class="race_report">
<div class="rep_img"><a href="index.php?mode=full_report&championship=<? echo $championship; ?>&track=<? echo $track; ?>&date1=<? echo $date1;?>"><? echo $imagefill; ?></a></div>
<div class="rep_title"><? echo $list; ?></div>
<div class="rep_by">By: <? echo $by." ".$date1; ?></div>
<div class="rep_desc"><? echo $rep_desc; ?><span class="rep_more"><a href="index.php?mode=full_report&championship=<? echo $championship; ?>&track=<? echo $track; ?>&date1=<? echo $date1;?>">...More→</a></span></div>
</div>
<?
if ($rowcount<=3)
{
echo "<br />";
}
$count++;
$rowcount++;
if($rowcount>=5 && $count<$num)
{
if($count>6 )
{
$counted=$count-10;
echo "<div class='report_prev'><a href='index.php?mode=reports&count=".$counted."'>←Previous Reports</a></div>";
}
echo "<div class='report_more'><a href='index.php?mode=reports&count=".$count."'>More Reports→</a></div>";
break;
}
}
if($count>=$num)
{
$newcount=6-$rowcount;
$count=$count+$newcount;
$counted=$count-12;
echo "<div class='report_prev'><a href='index.php?mode=reports&count=".$counted."'>←Previous Reports</a></div>";
}
?>
the link index.php?mode=full_report&championship=<? echo $championship; ?> etc call links to the index.php page and calls a object class
<div id="home"><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="781" height="408" id="templates/textbox1" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="templates/textbox1.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#000000" />
<embed src="templates/textbox1.swf" quality="high" bgcolor="#000000" width="781" height="408" name="textbox2" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object></div>
this in turn calls textbox1.swf which has a textbox with dynamic text that has been converted to a symbol and the actionscript in the symbol is
onClipEvent (load) {
loadVariables(“http://localhost/motorcross-news/templates/textbox1.php”, this, “GET”);
}
now if I hardcode the championship, track and date variables into the actionscript then all works fine ie
onClipEvent (load) {
loadVariables(“http://localhost/motorcross-news/templates/textbox1.php?championship=Eastern Centre&track=Lyng&date1=14-10-2007”, this, “GET”);
}
but as the original click came from a dynamically crated list of race reports I need the actionscript to be able to pass the variables from the orgimal click to textbox1.php
the code for textbox1.php is
<?PHP
require("connect.php");
$championship=$_REQUEST['championship'];
$date1=$_REQUEST['date1'];
$track=$_REQUEST['track'];
$sql="SELECT * FROM report WHERE championship = '$championship' AND track = '$track' AND date1 = '$date1'";
$rs=mysql_query($sql);
$i=0;
$num=mysql_num_rows($rs);
while ($row=mysql_fetch_array($rs))
{
$report=$row("rep1");
}
print "myVar=$report";
?>
any help would be greatly appreciated
I know I have posted this in flash but I am comfortable with the php and MySQL but I am having trouble passing the variables throught the flash file