# I cant get this tutorial..can someone help

**URL:** <https://forum.kirupa.com/t/i-cant-get-this-tutorial-can-someone-help/59747>\
**Category:** programming\
**Created:** [August 3, 2004, 3:01pm UTC](https://forum.kirupa.com/t/i-cant-get-this-tutorial-can-someone-help/59747 "2004-08-03T15:01:46Z")\
**Posts on this page:** 10\
**Page:** 2

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 4, 2004, 5:06pm UTC](https://forum.kirupa.com/t/i-cant-get-this-tutorial-can-someone-help/59747/21 "2004-08-04T17:06:56Z")

</div>

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… 🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 4, 2004, 5:42pm UTC](https://forum.kirupa.com/t/i-cant-get-this-tutorial-can-someone-help/59747/22 "2004-08-04T17:42:48Z")

</div>

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

```auto
 
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

<?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]";}
?>

```

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 5, 2004, 5:02am UTC](https://forum.kirupa.com/t/i-cant-get-this-tutorial-can-someone-help/59747/23 "2004-08-05T05:02:40Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 5, 2004, 1:46pm UTC](https://forum.kirupa.com/t/i-cant-get-this-tutorial-can-someone-help/59747/24 "2004-08-05T13:46:27Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 5, 2004, 10:04pm UTC](https://forum.kirupa.com/t/i-cant-get-this-tutorial-can-someone-help/59747/25 "2004-08-05T22:04:57Z")

</div>

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

```php
<?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=](http://www.mysite.com/read.php?file=)(I have no idea what to put here)]([http://www.mysite.com/read.php?file=](http://www.mysite.com/read.php?file=)(I have no idea what to put here)), this, “GET”);  
> }

Thanks for your help 🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 6, 2004, 2:05pm UTC](https://forum.kirupa.com/t/i-cant-get-this-tutorial-can-someone-help/59747/26 "2004-08-06T14:05:37Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 7, 2004, 7:11am UTC](https://forum.kirupa.com/t/i-cant-get-this-tutorial-can-someone-help/59747/27 "2004-08-07T07:11:46Z")

</div>

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. 🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 7, 2004, 4:36pm UTC](https://forum.kirupa.com/t/i-cant-get-this-tutorial-can-someone-help/59747/28 "2004-08-07T16:36:54Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 7, 2004, 7:08pm UTC](https://forum.kirupa.com/t/i-cant-get-this-tutorial-can-someone-help/59747/29 "2004-08-07T19:08:50Z")

</div>

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.

```php
 if ($_GET['file']) {
 

```

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

> loadVariables([[http://www.mysite.com/read.php?file...at](http://www.mysite.com/read.php?file...at) to put here)]([http://www.mysite.com/read.php?file=](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 🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 7, 2004, 11:19pm UTC](https://forum.kirupa.com/t/i-cant-get-this-tutorial-can-someone-help/59747/30 "2004-08-07T23:19:45Z")

</div>

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…

```php

 $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…

[Previous page](https://forum.kirupa.com/t/i-cant-get-this-tutorial-can-someone-help/59747.md?page=1)
