Jump to content

Archived

This topic is now archived and is closed to further replies.

tome

[SOLVED] flash->php->sql->php->flash

Recommended Posts

 

 

 

Hi there, i've got a flash based video site, i'm working on integrating a guestbook so users can leave comments about the videos.

 

this is my communication scheme:

flash->php->sql->php->flash

my write function works great and the user can leave a comment based on unique titleID (video number)

but i'm having a hard time fetching entries related to the current playing video, in my flash output window i can see that my videoID variable (video number) is passed from flash to php using loadVars so i assume that i've got a problem with my php script. This is the code I'm using in php to fetch data from sql:

 

$id=mysql_escape_string($_GET['videoID']);

$sql = "SELECT * FROM $table WHERE titleID = $id";

 

any ideas?

Share this post


Link to post
Share on other sites

<?php

$sql = "SELECT * FROM $table WHERE titleID = '$id'"; 

?>

 

Share this post


Link to post
Share on other sites

 

ok it's working now thank you, however i fetch zero entries even though i've got comments for the video playing stored in the database. i added this php print code:

 

print '<PRE style="text-align:left;">'; print_r($sql); die("<P>Script Halted...</P>"); print '</PRE>';

 

and when i test it online i get this sql quary:

 

SELECT * FROM guestbook WHERE titleID = '000000000?videoID=000000000' ORDER BY `time` DESC LIMIT 0, 10Script Halted...

 

while the sql quary that will yield results should be:

SELECT * FROM guestbook WHERE titleID = '000000000' ORDER BY `time` DESC LIMIT 0, 10

 

somehow i pass my variable twice???

 

this is my flash request:

 

myEntries = new LoadVars();

myEntries.ref = this

myEntries.videoID = videoID

myEntries.sendAndLoad("GuestBook.php?action=read&r="+random(999)+"&NumLow="+_parent.NumLow+"&videoID="+videoID,myEntries,"GET");

 

 

and again my php code:

 

$id=mysql_escape_string($_GET['videoID']);

$sql = "SELECT * FROM $table WHERE titleID = '$id'";

 

any ideas?

 

 

 

Share this post


Link to post
Share on other sites

and your source code isn't helpful since its all in flash check your flash links because odds are is what i said earlier and so ?videoid=THISID and the ?newvariable until it finds another & or end of url is reached

Share this post


Link to post
Share on other sites

 

 

well i'm testing but it seems fine to me yet i still get the ? after my titleID number at the flash output window.

 

 

this is my flash code:

 

 

myEntries = new LoadVars();

myEntries.sendAndLoad("GuestBook.php?action=read&r="+random(999)+"&NumLow="+_parent.NumLow+"&videoID="+videoID,myEntries,"GET");

 

 

and this is how it looks in the output window:

 

"/GuestBook.php?action=read&r=634&NumLow=0&videoID=00000000?"

 

 

how do i get rid of the ? after the id number...???

 

Share this post


Link to post
Share on other sites

my suggestion is to use post with your sendAndLoad. it clearly states in the flash documentation that you are limited to 256 characters with get

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.