Jump to content

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


tome

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?

Link to comment
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?

 

 

 

Link to comment
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...???

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.