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. when i test the movie in flash i can see in the output window that the titleID number is stored in the videoID variable and 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";

when i test it in a browser i use safari activity window and i get this message:

Error in GuestBook Application: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?videoID=000000000' at line 1

any ideas?

    Add this...

    echo $sql;
    

    ...and let us know what it says.

      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?

        Huh... that's interesting. Have you tried using two different LoadVars() objects (one to send, and one to receive).

        Flash Manual wrote:

        var submitListener😮bject = new Object();
        submitListener.click = function(evt😮bject) {
        var result_lv:LoadVars = new LoadVars();
        result_lv.onLoad = function(success:Boolean) {
        if (success) {
        result_ta.text = result_lv.welcomeMessage;
        } else {
        result_ta.text = "Error connecting to server.";
        }
        };
        var send_lv:LoadVars = new LoadVars();
        send_lv.name = name_ti.text;
        send_lv.sendAndLoad("http://www.flash-mx.com/mm/greeting.cfm", result_lv, "POST");
        };
        submit_button.addEventListener("click", submitListener);

        Hope that helps.

          got it to work "POST" instead "GET" in the loadVars object did the trick 🙂

            13 days later

            hey...tomera

            will u please post the code for uploading and playing the videos?tht would be great help for me....

             [url]http://www.phpbuilder.com/board/showthread.php?t=10342682[/url]
            
            Thanks
              Write a Reply...