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?

 

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?

 

 

 

odds are your url has multiple get variables taht aren't porperly being delimtetred

in the url a get var must be in the method

 

http://mypage.com/page.html?getvar1=value1&getvar2=value2&getvar3=value3    each one is seperated by & not a question mark

 

 

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

 

Archived

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

×
×
  • 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.