I cant get this tutorial..can someone help

Do me a favor and post the working PHP and AS so that other people can see how the script should be in case they are dealing with the same tutorial… :slight_smile:

for the AS all i have is this code on the first frame (only frame) i have

 
loadVariables("[http://www.yourwebsite.com/read.php?file=testfile](http://www.yourwebsite.com/read.php?file=testfile)", this, "GET");

and here is my php code


<?php 
//read.php 
//prints contents of content column where filename = $file
if ($_GET['file']) {
$link = mysql_connect("databaselocation", "login", "password")
or die("<b>error</b>: failed to connect to database");
mysql_select_db("databasename",$link);
$query = "SELECT content FROM files WHERE filename='$file'";
$result = mysql_query($query) 
or die("<b>error</b>: failed to execute query <i>$query</i>");
mysql_close($link);
$desiredContent = mysql_fetch_array($result, MYSQL_ASSOC);
mysql_free_result($result);
print "content=$desiredContent[content]";}
?>

How can i get this querry to dispaly in flash, I created a dynamic text field with variable name ‘content’. But I am having problems setting up the php file.?

//Total page Views
$sql = “SELECT count FROM “.$prefix.”_counter WHERE type=‘total’ AND var=‘hits’”;
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$pageview = "Total Hitz <b>$row[0]</b> ";

Any help would be greatly appreciated…Thanks

You need to use echo() or print function to print out the result like sizzle’s example so that Flash can pick it up… :slight_smile:

Thanks for your reply. Could you help me a little more, tell me what I am doing wrong. Here is my php file.

<?php 
//read.php 
//prints contents of content column where filename = $file
if ($_GET['file']) {
$link = mysql_connect("localhost", "username", "mypass")
or die("<b>error</b>: failed to connect to database");
mysql_select_db("mydatabasename",$link);
$sql = "SELECT count FROM ".$prefix."_counter WHERE type='total' AND var='hits'";
$result = $db->sql_query($sql);
or die("<b>error</b>: failed to execute query <i>$sql</i>");
mysql_close($link);
$pageview = "Total Hitz <b>$row[0]</b> ";
print "content=$pageview[content]";}
?>  

and here is my action script.

onClipEvent (load) {
loadVariables([http://www.mysite.com/read.php?file=(I have no idea what to put here)](http://www.mysite.com/read.php?file=(I have no idea what to put here)), this, “GET”);
}

Thanks for your help :slight_smile:

I suggest you read this entire thread one more time to see if it makes sense or not… :slight_smile:

Hi, I read it but I still am not getting it. I am new to this so if you could help me i would really appreciate it. :slight_smile:

Okay… Tell me what YOU are trying to do then, and I’ll see if I can help you… :slight_smile:

Thanks for offering to help :). Ok, here is the query, I know it already works, it gets the total page views from a phpnuke table.

//Total page Views
$sql = “SELECT count FROM “.$prefix.”_counter WHERE type=‘total’ AND var=‘hits’”;
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$pageview = "Total Hitz <b>$row[0]</b> ";

There are two parts I basically don’t understand.

 if ($_GET['file']) {
 

In my query, what should I put where ‘file’ is?
and…

loadVariables([http://www.mysite.com/read.php?file...at to put here)](http://www.mysite.com/read.php?file=(I have no idea what to put here)), this, “GET”);

after the ‘read.php’ how do i determine what goes there?..

Thanks :slight_smile:

According to the original tutorial, Flash is sending out a variable called ‘file’ when calling the read.php file…
Read.php file receives that variable and utilizes it on this line…


 $query = "SELECT content FROM files WHERE filename='$file'";
 

That way, PHP file can return the value back to Flash only for that specific condition…

The read.php file is specifically designed to work on that case… So, it is useless to go on any further if there is no variable sent when calling it, hence if ($_GET[‘file’]) is there to check if it should go any further or not…

I cannot really tell you WHAT you can supply… It can be anything that is stored in the database… In the tutorial, “testfile”, “test content. man i hope this works!” is supplied to the database, so the loadVariables() function call is sending out file=testfile value…

I hope that’s clear for you…

What’s that of your first paragraph supposed to be??? I see that you were showing the PHP script from the PHP Nuke… What’s that for??? I am not getting it at all…