# (mysql to flash)need major help

**URL:** <https://forum.kirupa.com/t/mysql-to-flash-need-major-help/315848>\
**Category:** flash\
**Created:** [November 5, 2010, 4:19pm UTC](https://forum.kirupa.com/t/mysql-to-flash-need-major-help/315848 "2010-11-05T16:19:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![MFRS](https://avatars.discourse-cdn.com/v4/letter/m/aca169/32.png) [@MFRS](https://forum.kirupa.com/u/MFRS)\
**Post date:** [November 5, 2010, 4:19pm UTC](https://forum.kirupa.com/t/mysql-to-flash-need-major-help/315848/1 "2010-11-05T16:19:23Z")

</div>

HI NEED MAJOR HELP. I’m trying to make a game where u answer questions about the various countries of the Europpean Union .I have a 500+ question database, with 20 questions for each of the 27 countries of the Europpean Union. The problem is that i cant link lots of stuffs that i’m not too familiarized with, in terms of programming. The objective is when choosing a country through a button, it gets 3 random questions out the 20 of that country. Then if u get all the questions right( 3) u get an item. I dont know how to make the dynamic boxes clickable. How can i make the flash recognize the right answer? PLZ I NEED HELP.

The structure of the database is:

QUestion  
id  
correctanswer  
answer1  
answer2  
answer3

My questions are:

How can i link 3 random questions of the country i select

The codes are these ones:

PHP:  
\<?php require\_once(‘Connections/db\_con.php’); ?\>

\<?php

$pais = “italia” ;  
/_$pergunta1\_f = $\_POST[‘pergunta1’];  
$pergunta2\_f = $\_POST[‘pergunta2’];  
$pergunta3\_f = $\_POST[‘pergunta3’];_/

$output = “”;

mysql\_select\_db($database\_db\_con, $db\_con);  
$query\_Recordset1 = “SELECT \* FROM $pais ORDER BY RAND()”;  
//$query\_Recordset1 = “SELECT \* FROM portugal”;  
$Recordset1 = mysql\_query($query\_Recordset1, $db\_con) or die(mysql\_error());  
$row\_Recordset1 = mysql\_fetch\_assoc($Recordset1);  
$totalRows\_Recordset1 = mysql\_num\_rows($Recordset1);  
?\>

\<?php for ($n=1; $n\<=3; $n++) {  
$output .= “correcta”.$n."=".$row\_Recordset1[‘correcta’]."&pergunta".$n."=".$row\_Recordset1[‘pergunta’]."&resposta".$n.“1=”.$row\_Recordset1[‘resposta1’]."&resposta".$n.“2=”.$row\_Recordset1[‘resposta2’]."&resposta".$n.“3=”.$row\_Recordset1[‘resposta3’]."&";  
$row\_Recordset1 = mysql\_fetch\_assoc($Recordset1);}  
$output = substr($output,0,-1);  
echo($output);  
?\>

\<?php  
mysql\_free\_result($Recordset1);  
?\>

FLASH:

var request:URLRequest = new URLRequest (“[http://localhost/phpToFlash.php](http://localhost/phpToFlash.php)”);  
request.method = URLRequestMethod.POST;

var vars:URLVariables = new URLVariables();  
vars.pais = “portugal”;

request.data = vars;

var phpVars:URLLoader = new URLLoader();  
phpVars.addEventListener(Event.COMPLETE, go);  
phpVars.dataFormat = URLLoaderDataFormat.VARIABLES;  
phpVars.load(request);

function go(e:Event):void {

```
vars = phpVars.data;

```

/\* trace(vars.correcta2);  
trace(vars.pergunta2);  
trace(vars.resposta21);  
trace(vars.resposta22);  
trace(vars.resposta23);

```
*/
resposta1.addEventListener(MouseEvent.CLICK,res);
resposta2.addEventListener(MouseEvent.CLICK,res2);
resposta3.addEventListener(MouseEvent.CLICK,res3);
perguntas.text=(vars.pergunta2);

function res (e:MouseEvent) :void{
    (vars.resposta21);
}
function res2 (e:MouseEvent) :void{
    (vars.resposta22);
}
function res3 (e:MouseEvent) :void{
    (vars.resposta23);
}

```

PLZ HELP. IF U CAN HELP,THANKS A LOT.
