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

Link to comment
Share on other sites

<?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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.