makoinater Posted March 10, 2008 Share Posted March 10, 2008 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 id #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 Link to comment https://forums.phpfreaks.com/topic/95381-trouble-getting-php-to-get-correct-var-with-mysql/ Share on other sites More sharing options...
trq Posted March 10, 2008 Share Posted March 10, 2008 <?php if (isset($_POST['username'])) { $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'"; if ($result = mysql_query($sql, $link)) { if (mysql_num_rows($result)) { $row = mysql_fetch_assoc($result); print "&res={$row['rss']}"; } } mysql_close(); } ?> Link to comment https://forums.phpfreaks.com/topic/95381-trouble-getting-php-to-get-correct-var-with-mysql/#findComment-488460 Share on other sites More sharing options...
makoinater Posted March 10, 2008 Author Share Posted March 10, 2008 Yes thank you very much that worked perfectly And unbelievably quick aswell! 3minutes no less Link to comment https://forums.phpfreaks.com/topic/95381-trouble-getting-php-to-get-correct-var-with-mysql/#findComment-488464 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.