Hi.
I am new to PHP and I am trying to modify some code to read a value from a mySQL database and save it in a session variable, then in a function that will run when the user is done I need to retrieve that variable and concatenate it to a string.
My attempt is not working. Here is what I tried:
To read the value from the database and store it:
$result = mysql_query(“select language_id from tribecastaging.tblst_game where id = ‘$game_id’”);
if(0 < mysql_num_rows($result))
$gameData->languageId = mysql_fetch_object($result);
In later function:
var successes = <?php $success = Array(); $languageID = intval($gameData->languageId); $count = 0; if ($dh = opendir("responseAudio/".$languageID)) { while (($audioName = readdir($dh)) !== false) { if(strpos($audioName, "ok") === 0){ $success[$count] = "responseAudio/{$languageID}/".$audioName; $count++; } } } closedir($dh); echo json_encode($success); ?>; What am I doing wrong? Thank you!