Trying to understand how to do this!

Ok i have 3 database tables that im useing here for this and im trying to understand how to do it.

i have account table where username password avatar is located.
I have user comment table where the users can post a comment
and i have user friend list table where if user1 is user2 friend status change to 1 from 0

so my php scrip is pulling data from mysql to a xml file
This script pulls the data back to the client.
How ever what i need to do is set up some sort of change in the file stating this

[php]<?php
//include the connect script
include “connect.php”;

//Lets get the right user
$username = $_GET[‘username’];
$avatar = $_GET[‘avatar’];
$comment = $_GET[‘comment’];
$sql2 = mysql_query(“SELECT * FROM user_friends_list WHERE username = ‘$username’”);
$sql = mysql_query(“SELECT * FROM user_comments WHERE username = ‘$username’”);
$sql1 = mysql_query(“SELECT * FROM accounts WHERE username = ‘$username’”);

$user_xml = “<?xml version=\"1.0\"?>\n”;
$user_xml .= “\n”;
$user_xml .= “\n”;
while ($row1 = mysql_fetch_array($sql1, MYSQL_NUM))
{
while ($row = mysql_fetch_array($sql, MYSQL_NUM))
{
$user_xml .= “” . $row[‘1’] . “\n”;
$user_xml .= “” . $row1[‘7’] . “\n”;
$user_xml .= “” . $row[‘3’] . “\n”;
}

}
$user_xml .= “\n”;
$user_xml .= “\n”;
echo $user_xml;
?>[/php]

i need the script to get the friends list table and if a friend a friend and the status = 1 pull that usersname comments also.
any idea how to do this?

ok i some how need to get the xml file to post all comments from that friend or any other friend.
hers what i got so far but no luck yet.

you can see a demo of the xml file here to see
http://wiistream.net/flash/getfriends.php?username=mancent

[code]<?php
//include the connect script
include “connect.php”;

//Lets get the right user

$username = $_GET[‘username’];
$avatar = $_GET[‘avatar’];
$comment = $_GET[‘comment’];
$friend = $_GET[‘friend’];
$sql2 = mysql_query(“SELECT * FROM user_friends_list WHERE username = ‘$username’”);

$sql = mysql_query(“SELECT * FROM user_comments WHERE username = ‘$username’”);
$sql1 = mysql_query(“SELECT * FROM accounts WHERE username = ‘$username’”);

$user_xml = “<?xml version=\"1.0\"?>\n”;
$user_xml .= “\n”;
$user_xml .= “\n”;

// check again for the existence of the relationship
while ($row3 = mysql_fetch_array($sql2, MYSQL_NUM))
{
if ($row3[‘3’] == 1)
{
while ($row1 = mysql_fetch_array($sql1, MYSQL_NUM))
{
while ($row = mysql_fetch_array($sql, MYSQL_NUM))
{
$user_xml .= “” . $row[‘1’] . “\n”;
$user_xml .= “” . $row1[‘7’] . “\n”;
$user_xml .= “” . $row[‘3’] . “\n”;
$user_xml .= “” . $row3[‘2’] . “\n”;
$user_xml .= “” . $row3[‘3’] . “\n”;
}

}
}
}

$user_xml .= “\n”;
$user_xml .= “\n”;
echo $user_xml;

?>[/code]

Sponsor our Newsletter | Privacy Policy | Terms of Service