A Very Simple Album Problem, Help Needed.

free web hosting
Open Discussion > CONTRIBUTE > Computers > Programming Languages > PHP Programming

A Very Simple Album Problem, Help Needed.

apple
Hey, I created a page album.php, it shows all the images of a user xxx. and its url is like album.php?nick=xxx. Now suppose there are 2 images in this user album, one image id is 111 and second image id is 112.now how i can link to the each image of the album so that it looks like , album.php?nick=xxx&image_id=111. and album.php?nick=xxx&image_id=112.
I hope you understand it.

Reply

jlhaslip
Can you show us some code please?
We can help you, but we need to see what you have available for information to use. For instance, are you storing the filenames in a database or picking them up using a readdir()? See what I mean?
The answer will depend on several things, the code will provide us the clues needed to help you solve the problem.

Reply

apple
here's the code.

CODE
<?
ob_start();
include("config.php");
if (!$_GET[nick])
{
$getuser = mysql_query("SELECT * from users order by id asc");
while ($user = mysql_fetch_array($getuser))
{

echo ("<a href=\"album1.php?nick=$user[username]\">$user[username]</a><br />\n");

}
}
ELSE
{
$getuser = mysql_query("SELECT * from pictures where username = '$_GET[nick]'");
$usernum = mysql_num_rows($getuser);
if ($usernum == 0)
{
echo ("User Not Found");
}

else
{
while ($row = mysql_fetch_array($getuser)) {
echo "<a href='funnypics/$row[link]' target='_blank'><img src=funnypics/$row[link] width='200px'></a><br>";

}
}
}
?>

 

 

 


Reply

jlhaslip
Here is a code snippet that will work.
Do the mysql call and build the links as per your previous posting.
CODE

<?php

if (isset( $_GET['pix'] )) {

echo 'create the specific image here<br /><br />';
echo 'create link for the nick and the start pages here<br /><br />';
echo '<a href="http://localhost/image%20code%20test.php?nick=1" > nick1 </a><br /><br />';
echo '<a href="http://localhost/image%20code%20test.php" > start over </a>';

}

else if ( isset($_GET['nick'] )) {

echo 'display image gallery for nick here<br /><br />';
echo 'create list of specific images here<br /><br />';
echo '<a href="http://localhost/image%20code%20test.php?nick=1&pix=1" > image1 </a><br /><br />';
echo '<a href="http://localhost/image%20code%20test.php?nick=1&pix=2" > image2 </a><br /><br />';
echo '<a href="http://localhost/image%20code%20test.php?nick=1&pix=3" > image3 </a><br /><br />';
echo '<a href="http://localhost/image%20code%20test.php?nick=1&pix=4" > image4 </a>';
echo '<a href="http://localhost/image%20code%20test.php" > start over </a>';
} else {

echo 'create list of links for nicks here<br /><br />';
echo '<a href="http://localhost/image%20code%20test.php?nick=1" > nick1 </a><br /><br />';
echo '<a href="http://localhost/image%20code%20test.php?nick=2" > nick2 </a><br /><br />';
echo '<a href="http://localhost/image%20code%20test.php?nick=3" > nick3 </a><br /><br />';
}

?>

Just add the "pix= x " to the anchor tags in the centre if/else codeblock and it should work marvellously for you. You may want to do a check to confirm that the files exist before you make the links, using the is_file() function.
Let us know if you need any more information.

Don't forget to finish the ob_start() and close the database. PHP takes care of all that, I know, but attention to detail makes a difference sometimes.

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.

Similar Topics

Keywords : simple, album, problem, needed

  1. Tutorial Needed?!
    PHP+Ajax (11)
  2. Admin Page
    Tutorial Needed? (4)
    I need to look at a nice tutorial how do you create an admin access page with many functions as many
    as possible.....
  3. Tools Needed!
    PHP & MySQL (9)
    Hello, everyone! I need some tools for those two things to test PHP scripts coming together with
    database on my laptop, instead checking them on a web-server which takes time.....
  4. Php Code Needed Iii
    (10)
    Hello, everyone. I need your help again! Who might create the PHP code, the picture is
    above this text. Basically, I want when the user fill in all the information in this form, it
    automatically was sent to my email. And, then, the dialog box appears or on the same window, it was
    said that your request has been sent. Moreover, if the user did not fill the entire information,
    the dialog box appears stating that you did not fill some field. Thanks, for help. You always do
    that.....
  5. Looking For Command Line Based Sql Modification
    Program Needed For SQL? (1)
    How I use Windows command prompt client and do modifications to my SQL database. If yes, please
    write the commads I should know for that. If no, please get me the software with which I can do it.
    Topic title modified. Proper English is always required when posting in our forum. ....
  6. Php Code Needed
    Working Together? (5)
    Hello, everyone. I need your help again. This forum is quite good for it. Well, I need create a
    registration form for my web-site using PHP and SQL. The information it should contain: 1) User
    Name 2) First Name 3) Last Name 4) Password 5) e-mail Address 6) Security Image: that images helps
    to protect a random registration, for instance, 56+2=where user have to type an answer in order to
    finish registration. That's all for today. Anymore things, I will post another post over here.
    ....
  7. Php Code
    Needed?! (15)
    Well, I am a novice in PHP programming, so there is a script which I wanna get: 1. You go the
    web-site 2. On the main screen, there is a some kind of field windows, the one you get used to type
    in, when you go to google, for instance. 3. He or she types her email address and it's going to
    be saved in my SQL database. 4. That's it. Help me if you can.....
  8. Slaed Cms
    Book Needed!!! (2)
    Hello, everyone! I need some tutorial for Slaed Engine for any version you might find. I wanna
    learn how you can make modules or blocks for this CMS. Especially, library functions and other
    things that will make the web-site works like virtual library.....
  9. Wamp Packages Needed To Test Scripts
    Set up Apache, PHP, etc on your machine (1)
    In order to test php scripts on your localhost machine, you require a system that includes php
    parsing. A WAMP set-up 'usually' includes a database server, and a database manager, too.
    For Windows machines, theses are usually referred to as WAMP because they include Apache, Mysql, and
    PHP for Windows, hence the acronym WAMP. Wikipedia has a listing of the available packages with
    details about the included versions and often a link to the wikipedia article describing them. The
    list can be found at http://en.wikipedia.org/wiki/Comparison_of_WAMPs Personally, I....
  10. Creatting A Playlist Through Php
    script help needed (5)
    Hi I am trying to make a script so that i can insert songs into a playlist, but i need a script in
    which it opens the playlist file and removes the closing tag at the end, so before i can add more
    entrys. e.g CODE <atx> <entry>Location 5</entry> <entry>Location
    4</entry> <entry>Location 3</entry> <entry>Location
    2</entry> <entry>Location 1</entry> <atx> But to add more entrys
    i would have to get rid of the atx, then use the fputs to place the new entry into the file. ....
  11. Ipetsite Related Programming Help Needed
    iPetSite screwed me over (0)
    Ok so i you are anyone here who would like to hlp me with these files, please pm me your email. Here
    is what i need help with: Replacement of lost files Repair of corrupt files Configuring said files
    Help with setting up the site If you can help me, please let me know. If you would like to be an
    admin on my site, also let me know. Just I request that you don't post here unless you plan or
    intend to help some how.....
  12. Php Help Needed Including File In A Page.
    (2)
    i'm a noob in php programming, i can understand and modify php programs, but i dont know to
    write on my own. So please somebody who is well versed in php help me. My need is, I'm
    currently builiding a knowledge base website , i've my own design for the website, check here,
    http://laschatz.info/kzone/ Each page in the left hand site has a tree navigation of all the
    topics available. Since this information must be same in all the pages, presently I need to change
    all the pages after adding a new category. Could you please help me in such a way that I can ad....
  13. Help Needed With Directory/file Listing Code Infinite Loop
    Made an infinite loop but why is this so? (5)
    Hi all ive got a small and simple (for the moment atleast /unsure.gif"
    style="vertical-align:middle" emoid=":unsure:" border="0" alt="unsure.gif" /> )file and directory
    listing script in php as follows CODE $dir = "."; $num = 0; $file =
    scandir($dir); while($file = scandir($dir)){     echo
    $file[$num];     echo "<BR>";     $num = $num + 1;     
    }; the concept is simple enough, the directory to start with is the current one, so scan this
    directory and wh....
  14. Php - Fsockopen, Get, Etc - Help Needed
    (1)
    Hi I am writing a PHP script that gets the search results from here . I can get the results from
    the first page fine, but when I try to get the next page, it doesn't return the correct results.
    Try comparing the results from here , and searching for "Vampire" (In the "Name" text box) here .
    The first page of results is the same, but when you go on the the second page of results, they are
    totally different. This I think is because the "persist_search" (see the URI on the Planet Elder
    Scrolls Search) always seems invalid. Is there any reason why the PHP would get....
  15. Help Needed With Silly Error
    (8)
    Hi i have made a stupid error on one of my pages and having trouble finding it. It says unexpected
    ')' on line 114 can anyone please help me find it? Here is the page: CODE <? /** *
    * @package TibiaME Clan/Download Site * @version 1.00 2006/09/27 00:04:37 wappy * @copyright
    (c)2004-2006 wappyCULT * @home http://hack.s-60.org * @license You can use/modify this
    script but distributing it without permisinn, or removing the "Script By: wappy" link
    will invalidate your license and give wappy (wappyCULT) FULL RIGHTS to ....
  16. Good Mp3 And Album Script
    Need Help (0)
    hi all my friend wants to make one website He want put His band Mp3 in website with album cover
    and link for download ... Free Its not important This PHP Script is free or not he want good sound
    website plz help me to find this kind of scripts thanks /smile.gif"
    style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /> ....
  17. Show Users Logged In
    Some help needed.. (5)
    I need some help if somebody can help me out please doit /smile.gif" style="vertical-align:middle"
    emoid=":)" border="0" alt="smile.gif" />.. Ok here is the thing - I have an login box (works
    perfect) and I have MySQL database (works perfect).. Now I need to make thing like a list where
    shows everyone who is logged on.. But making it I need to use the same MySQl database and the same
    login box.. Example: when your write tour Login and password and press "Log-in!" opens page
    where is list of all logged in member.. If there is ant tutorial aor scripts/codes please....
  18. php header() function help needed
    automatic re-direct (4)
    hey ppl, u seem to have real gud knowledge about php, i just wanted a little help...i designed this
    website, but i want that if i click on certain page, it should open for some few seconds and then
    browser should automatically redirect me to some other page....i tried this with header() function
    but i couldnt do the wait n redirect part, ... so somebody plz help.... -thanx in advance!....
  19. Visitors Online
    With PHP (no MySQL is needed) (9)
    Another script, which shows the visitors onlineat the moment in your site. This script was not made
    by me, I just think it will be very usefull to u. CODE <? $timeout = 15; // change
    it. It is the timer which will delete the member of  online list (in minutes) if
    (!$datei) $datei = dirname(__FILE__)."/online.txt"; $time
    = @time(); $ip = $REMOTE_ADDR; $string =
    "$ip|$time\n"; $a = fopen("online.txt", "a+");
    fputs($a, $s....
  20. Visitors Counter
    With PHP (no MySQL needed!) (4)
    Well, here we will make an hit counterusing php and an *.txt file. This script is so simple, but
    very usefull. First, le'ts make an file called counter.php, with the following codes inside:
    CODE <? $file = 'counter.txt'; // this is the file where the number of visitors
    will be written $fopen = fopen("$file", "r"); // open the text
    file $count = fread($fopen, 1024); // read the text file fclose($fp);
    // close the text file $count = $count + 1; // add one more hit echo &#....
  21. Calling All Php Programmerss Help Needed
    as soon as possible (2)
    hello people im currently working on an open source web software installer kinda like fantastico ,
    but actually for webservers running apache on windows based systems and the biggest part of this
    will be an update website, where people that have already got this installed can actually update the
    existing packages, i have already figured out how the downloads work but im kinda running out of
    ideas, so if anyone has any idea what i could include please tell me, jus give me the idea and ill
    try sort out the code. so any suggestion all i have got so far is 1.i know how to ge....

    1. Looking for simple, album, problem, needed

*RANDOM STUFF*





*SIMILAR VIDEOS*
Searching Video's for simple, album, problem, needed

*MORE FROM TRAP17.COM*
advertisement



A Very Simple Album Problem, Help Needed.



 

 

 

 

ADD REPLY / Got an Opinion! a humble request :-) RAPID SEARCH! Free Hosting [X]
Express your Opinions, Thoughts or Contribute your information that might help someone here.
Ask your Doubts & Queries to get answers.. "Together, We enlight each other!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE