PDA

View Full Version : Cant get correct Var back from MysQL DB


makoinater
03-06-2008, 06:47 PM
Im using PHP to Query My Database for the entry in the field 'rss' in the user table with the 'user_id' as $user_id. Now Iv been successful in using PHP with actionscript to put in variables into my database and to bring vars back.
But when I should be getting a value that looks like httP://.....xml It brings me back something like 'Resouce#3'
heres the code I have -
<?php
$user_id = $_POST['username'];

$link = mysql_connect("xxxx", "xxxx","xxxx") or die ("Unable to connect to database.");
mysql_select_db("markfar_user") or die ("Unable to select database.");

$sql= "SELECT rss FROM users WHERE user_id = '$user_id'";
$result = mysql_query($sql, $link);
print "&res= $result";

mysql_close();
?>




Any Help? cheers

Cota
03-08-2008, 05:04 AM
What exactly is it spitting back..and have you tested it by hitting the PHP page directly?

makoinater
03-08-2008, 12:39 PM
Its exact text is "Resoucre id #3" if you go here you can test it http://markfarl.com/project.php

you setup your username and select rss feed from top flash app, then when you log on to the phone screen just a bit down below the rss feed you selected should come up(just the address i eventually want the rss actual feed to scroll across) cant test the php on its own because without the varible sent from flash it wont get anything.
heres the actionscript to send.
stop();
var varrss:LoadVars = new LoadVars();
varrss.username = _global.username;
varrss.onLoad = function(success) {
if (success) {
trace(varrss.res);
gotoAndPlay(18);
newvarr = varrss.res;
} else {
trace("You have a problem now...");
}
};
varrss.sendAndLoad("http://markfarl.com/YEAR3/details/getrss.php?uniqueID="+getTimer(), varrss, "POST");


and to display the var in dynamic textbox with instance called the_var

the_var.text = newvarr;

Cota
03-09-2008, 11:17 PM
You can test it rather simply.
http://markfarl.com/YEAR3/details/getrss.php?username=SOmething

You may have change $_POST to $_GET