Jump to content

?question How can this be done?


Mancent

Recommended Posts

say i have a mysql table with the following fileds

 

user_id

picture_category

picture_title

picture_description

picture_thumb  //small image size

picture_normal  //large image size.

 

ok what I'm trying to do is this.

 

if( user_id && picture_category == the same name show all the pictures in that category as one section)

//show this category and all the images from this user_id and picture_category

 

so if this user_id has a new category name and new images uploaded it would show the images in the right category.

 

my php xml script is in the works and is looking like this so far.

<?php
include "../../connect.php";
Header('Cache-Control: no-cache');
Header('Pragma: no-cache');
$username = mysql_real_escape_string($_GET['username']);
$user_folder = mysql_real_escape_string($_GET['user_folder']);
//$password = mysql_real_escape_string($_GET['password']);
$friend = (isset($_GET['friend'])) ? ' AND b.friend = \'' . mysql_real_escape_string($_GET['friend']) . '\' ' : NULL;
$query = "SELECT * FROM accounts WHERE username = '$username'";
$results = mysql_query($query) or die("Data not found."); 
//Get the number of results from the query.
$rows = mysql_num_rows($results);




//If their is a match for the username, echo the the users xml data.
if($rows == 1) 
{
$query1 = "SELECT * FROM user_photo_gallery WHERE username = '$username'";
$query2 = "SELECT * FROM user_photo_gallery WHERE username = '$username' AND user_folder = '$user_folder'";
$results1 = mysql_query($query1) or die("Data not found."); 
$results2 = mysql_query($query2) or die("Data not found."); 
//$row = mysql_fetch_assoc($results1); 

$user_xml = "<?xml version=\"1.0\"?>\n";
$user_xml .= "<settings>\n";
$user_xml .= "<sceneHeight>600</sceneHeight>\n";
$user_xml .= "<sceneWidth>1000</sceneWidth>\n";
$user_xml .= "<titleColor>#000000</titleColor>\n";
$user_xml .= "<descriptionBgAlpha>70</descriptionBgAlpha>\n";
$user_xml .= "<showFullscreenBtn>no</showFullscreenBtn>\n";
$user_xml .= "<waterMark useImage=\"no\"><![CDATA[THIS]]></waterMark>\n";
$user_xml .= "</settings>\n";
$user_xml .="<galleries>\n";
//$sql = "SELECT a.username,a.user_folder,a.large_pic,a.small_pic,a.pic_title,a.pic_discription,b.username FROM (user_photo_gallery as a )JOIN `user_friends_list` as b ON (b.friend = a.username)WHERE (b.username = '$username' $friend AND b.status = 1) ORDER BY a.user_folder DESC";
//$result2 = mysql_query($sql);
//if(mysql_num_rows($result2) > 0) 
//{  
while ($row = mysql_fetch_assoc($results1)) 
{
$user_xml .="<gallery theName=\"". $row['user_folder'] ."\" itemsPerRow=\"3\" autoStart=\"no\" playTime=\"5\" autoResize=\"yes\" xOffset=\"5\" yOffset=\"10\" showTitleOnThumbs=\"yes\" allowDownload=\"yes\">\n";
if($row['user_folder'] =="Demo_Photos")
{
//select all pictures where this folder name and username maybe?
while ($row1 = mysql_fetch_assoc($results2)) 
{
$user_xml .="<picture largePicture=\"". $row1['large_pic'] ."\" smallPicture=\"". $row1['small_pic'] ."\" theTitle=\"". $row1['pic_title'] ."\"><![CDATA[". $row1['pic_discription'] ."]]>\n";

$user_xml .="</picture>\n";
}
}
else
{

}
$user_xml .="</gallery>\n";
}
//}
//else
//{
//echo "Wiistream Eorror!\n";
//};
$user_xml .="</galleries>\n";
echo $user_xml; 
}
else
{
echo "Wiistream Eorror!\n";
}

?>

 

 

the real xml file should look like this.

<?xml version="1.0" encoding="utf-8"?>

<settings>

<sceneHeight>600</sceneHeight>

<sceneWidth>1000</sceneWidth>

<titleColor>#000000</titleColor>

<descriptionBgAlpha>70</descriptionBgAlpha>

<showFullscreenBtn>no</showFullscreenBtn>

<waterMark useImage="yes"><![CDATA[<font size="20">Copyright (c) 2010</font> <font color="#000000"><Strong>WiiStream</Strong></font>]]></waterMark>

</settings>



<galleries>

<gallery theName="USERS PERSONAL GALLERY TITLE" itemsPerRow="3" autoStart="no" playTime="5" autoResize="yes" xOffset="5" yOffset="10" showTitleOnThumbs="yes" allowDownload="yes">

	<picture largePicture="http://acadianfury.files.wordpress.com/2007/01/mazda.jpeg" smallPicture="http://acadianfury.files.wordpress.com/2007/01/mazda.jpeg" theTitle="USERS TITLE OF PICTURE"><![CDATA[uSERS DISCRIPTION OF PICTURE CAN USE TAGS]]></picture>



</gallery>

<gallery theName="USERS PERSONAL GALLERY TITLE1" itemsPerRow="3" autoStart="no" playTime="5" autoResize="yes" xOffset="5" yOffset="10" showTitleOnThumbs="yes" allowDownload="yes">

	<picture largePicture="http://acadianfury.files.wordpress.com/2007/01/mazda.jpeg" smallPicture="http://acadianfury.files.wordpress.com/2007/01/mazda.jpeg" theTitle="USERS TITLE OF PICTURE"><![CDATA[uSERS DISCRIPTION OF PICTURE CAN USE TAGS]]></picture>
	<picture largePicture="http://acadianfury.files.wordpress.com/2007/01/mazda.jpeg" smallPicture="http://acadianfury.files.wordpress.com/2007/01/mazda.jpeg" theTitle="USERS TITLE OF PICTURE"><![CDATA[uSERS DISCRIPTION OF PICTURE CAN USE TAGS]]></picture>




</gallery>

<gallery theName="USERS PERSONAL GALLERY TITLE2" itemsPerRow="3" autoStart="no" playTime="5" autoResize="yes" xOffset="5" yOffset="10" showTitleOnThumbs="yes" allowDownload="yes">

	<picture largePicture="http://acadianfury.files.wordpress.com/2007/01/mazda.jpeg" smallPicture="http://acadianfury.files.wordpress.com/2007/01/mazda.jpeg" theTitle="USERS TITLE OF PICTURE"><![CDATA[uSERS DISCRIPTION OF PICTURE CAN USE TAGS]]></picture>
<picture largePicture="http://acadianfury.files.wordpress.com/2007/01/mazda.jpeg" smallPicture="http://acadianfury.files.wordpress.com/2007/01/mazda.jpeg" theTitle="USERS TITLE OF PICTURE"><![CDATA[uSERS DISCRIPTION OF PICTURE CAN USE TAGS]]></picture>
<picture largePicture="http://acadianfury.files.wordpress.com/2007/01/mazda.jpeg" smallPicture="http://acadianfury.files.wordpress.com/2007/01/mazda.jpeg" theTitle="USERS TITLE OF PICTURE"><![CDATA[uSERS DISCRIPTION OF PICTURE CAN USE TAGS]]></picture>
<picture largePicture="http://acadianfury.files.wordpress.com/2007/01/mazda.jpeg" smallPicture="http://acadianfury.files.wordpress.com/2007/01/mazda.jpeg" theTitle="USERS TITLE OF PICTURE"><![CDATA[uSERS DISCRIPTION OF PICTURE CAN USE TAGS]]></picture>


</gallery>
</galleries>

 

 

but using it with mysql it only gets the user_id and the picture_category for this user and pulls back that users data only.

I also have a join table included to join if this user has friendship with that user.

and then you would see all your pictures upload and category's. and all your friends pictures and category's.

 

 

 

Link to comment
Share on other sites

Ok i created two tables and did it this way so far..

But to get the idea you can test the links to see the different category's and images in that category.

 

heres the script so far. I need help joining the friends table where friendship is made. and if friendship is made then this script needs to echo the xml data where all friends images are and folders.

http://wiistream.net/php/user/pictures/gallery.php?username=Demo&user_folder=Category1

http://wiistream.net/php/user/pictures/gallery.php?username=Demo&user_folder=Category2

 

 

<?php
//lets get the mysql connection information.
include "../../connect.php";
//we need this because the flash stores the xml file in temp internet history.
Header('Cache-Control: no-cache');
Header('Pragma: no-cache');
//ok flash sent out the username
$username = mysql_real_escape_string($_GET['username']);
//ok flash sent out the folder name
$user_folder = mysql_real_escape_string($_GET['user_folder']);


//this part will be used becasue we need to see if friendship has ben made.
$friend = (isset($_GET['friend'])) ? ' AND b.friend = \'' . mysql_real_escape_string($_GET['friend']) . '\' ' : NULL;
//Ok lets select the username from the accounts table to see if they are a user..
$get_username = "SELECT * FROM accounts WHERE username = '$username'";
$username_results = mysql_query($get_username) or die("Data not found."); 
//Get the number of results from the query.
$check_username_mysql_rows = mysql_num_rows($username_results);




//If there is a match for the username, echo the the users xml data.
if($check_username_mysql_rows == 1) 
{
$lets_get_this_users_photos = "SELECT * FROM user_photo_gallery WHERE username = '$username'AND user_folder ='$user_folder'";
$lets_get_this_users_photos_results = mysql_query($lets_get_this_users_photos) or die("Data not found."); 


$lets_get_this_users_folders = "SELECT * FROM user_image_folders WHERE username = '$username'AND user_folder ='$user_folder'";
$lets_get_this_users_folders_results = mysql_query($lets_get_this_users_folders) or die("Data not found."); 

//TODO MAKE THE FRIENDSHIP WORK WITH THIS
//$sql = "SELECT a.username,a.user_folder,a.large_pic,a.small_pic,a.pic_title,a.pic_discription,b.username FROM (user_photo_gallery as a )JOIN `user_friends_list` as b ON (b.friend = a.username)WHERE (b.username = '$username' $friend AND b.status = 1) ORDER BY a.user_folder DESC";
//$result2 = mysql_query($sql);

$user_xml = "<?xml version=\"1.0\"?>\n";
$user_xml .= "<settings>\n";
$user_xml .= "<sceneHeight>600</sceneHeight>\n";
$user_xml .= "<sceneWidth>1000</sceneWidth>\n";
$user_xml .= "<titleColor>#000000</titleColor>\n";
$user_xml .= "<descriptionBgAlpha>70</descriptionBgAlpha>\n";
$user_xml .= "<showFullscreenBtn>no</showFullscreenBtn>\n";
$user_xml .= "<waterMark useImage=\"no\"><![CDATA[THIS]]></waterMark>\n";
$user_xml .= "</settings>\n";
$user_xml .="<galleries>\n";


while ($i_get_this_users_mysql_folder_name = mysql_fetch_assoc($lets_get_this_users_folders_results)) 
{

$user_xml .="<gallery theName=\"". $i_get_this_users_mysql_folder_name['user_folder'] ."\" itemsPerRow=\"3\" autoStart=\"no\" playTime=\"5\" autoResize=\"yes\" xOffset=\"5\" yOffset=\"10\" showTitleOnThumbs=\"yes\" allowDownload=\"yes\">\n";
while ($i_get_this_users_photo_folder_names = mysql_fetch_assoc($lets_get_this_users_photos_results))
{
if($i_get_this_users_mysql_folder_name['user_folder']/*AND IT EQULES AS THE SAME AS*/==$i_get_this_users_photo_folder_names['user_folder'])
{



$user_xml .="<picture largePicture=\"". $i_get_this_users_photo_folder_names['large_pic'] ."\" smallPicture=\"". $i_get_this_users_photo_folder_names['small_pic'] ."\" theTitle=\"". $i_get_this_users_photo_folder_names['pic_title'] ."\"><![CDATA[". $i_get_this_users_photo_folder_names['pic_discription'] ."]]>\n";
$user_xml .="</picture>\n";
}

}
$user_xml .="</gallery>\n";
}


$user_xml .="</galleries>\n";
echo $user_xml; 
}
else
{
echo "Wiistream Eorror!\n";
}

?>

 

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.