PDA

View Full Version : PHP error!



thatsdjmk
08 Sep 2010, 10:41 PM
hello!

i'm creating my website and while i'm trying to get a name from the sql databse of the forum i keep getting an error. trying everything but couldn't fix it.

<?

$story = $_GET['sid'];

// establish connection to the database containing the quotes.
$db = mysql_connect("localhost", "********", "********") or die ("Unable to connect to database.");
mysql_select_db("********") or die ("Unable to select database.");
// select the quotes that have not been displayed (q_mark = 0).


$author_id = mysql_query("SELECT author_id from travelstories WHERE story_id = $story");
$ts_username = mysql_query("SELECT username from community_users WHERE user_id = $author_id ");


while ($row = mysql_fetch_array($ts_username)) {
echo $row['username'];
}


?>

my web site is http://aboutraveling.com and is currenty under construction.

The error i'm getting is :

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/aboutra/public_html/travelstories_single.php on line 15


Thank you very much!