Jump to content

Trouble getting PHP to get correct Var with Mysql


makoinater

Recommended Posts

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

<?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();
}

?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.