Results 1 to 2 of 2
  1. #1
    Join Date
    May 2010

    Unanswered: reading a database and sorting.

    Yes, I am totally a noob in sql. I am trying to write a small program that will take the photo attachments in a forum and make them look like an album.

    I can read the database tables, and even get it to list everyone and all the photos. That is the problem. I want it to say read member #2 only and show only that members photos.

    When I say if ($member > "0") it will list all the members number just fine. (i.e. member #2 shows above his photo. Member #245 shows above his photo.)

    But if I say if ($member = "2") to try and get it to list ONLY member #2, it shows everyones photo but the member #2 shows above photos not even his.


    @mysql_select_db($database) or die( "Unable to select database");
    $query="SELECT * FROM ibf_attachments";



    echo "<b><center>Database Output</center></b><br><br>";

    while ($i < $num) {
    $member=mysql_result($result,$i,"attach_member_id" );

    if ($member > "0")

    $isimage=mysql_result($result,$i,"attach_is_image" );
    $imagesize=mysql_result($result,$i,"attach_filesiz e");
    $imagewidth=mysql_result($result,$i,"attach_img_wi dth");
    $imageheight=mysql_result($result,$i,"attach_img_h eight");
    $imagelocation=mysql_result($result,$i,"attach_loc ation");
    $imagethumblocation=mysql_result($result,$i,"attac h_thumb_location");

    $attachfile=mysql_result($result,$i,"attach_file") ;

    $str_2 = "$imagelocation";
    $str_3 = "$imagethumblocation";

    if ($isimage ="1")
    echo "<b>$member $isimage</b><br>Image Size: $imagesize<br> Image Width: $imagewidth<br> Image Height: $imageheight<br>$attachfile<br><a href=$str_2 target='blank'><img src='$str_3' alt='the image' /></a> <br>";

  2. #2
    Join Date
    May 2010
    over 25 views and not one clue or hint.

    Thanks tho! I'll try somewhere else then that might deal more specific with SQL and PHP.

    [This thread can be closed]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts