FireFox! The PHP Forum Loans and Credit
Panama Web Design for Hire Free Insurance Quotes!
Web Hosting Advertise Here $10 a Month Designer Children
Never Pay Taxes Again HGH Domain name registration
Web Hosting and Dedicated Servers Insurance Affordable web-hosting


HomeWatched TopicsRegisterSearchDirectory
FAQMemberlistUsergroupsLog inStoresItemsBank
Google

Reply to topic Page 1 of 1
Only showing it from one????
Message  

Reply with quote
Post Only showing it from one???? 
Its a odd title but I didn't know what else to call it, so here we go.......
I have created a script that should show pics from different users on a different page IE site.com/show.php?user=Person1 and site.com/show.php?user=Person2, but the thing is it only displays it from Person1, the script its self is fine, its just something to do with the MySQL database, if you remove Person1 then Person2s pics comes up, anyone got any suggestions??

View user's profile Send private message Visit poster's website

Reply with quote
Post  
What's your msyql query?

View user's profile Send private message

Reply with quote
Post  
If it works for you, and not others.. thats odd! lol j/p

But can we see a query?

View user's profile Send private message

Reply with quote
Post  
There has been a change the new code is:

Code:

<html><style type="text/css">
<!--
body {
    margin-left: 0px;
       margin-top: 0px;
        margin-right: 0px;
      margin-bottom: 0px;
}
-->
</style>
<table width="100%" background="images/stars.jpg">
<td><img src="images/movright.jpg" align="right">
</td>
</table>
<title>Welcome to Sim and Sim.com</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">


<style type="text/css">
<!--
body {
     margin-left: 0px;
       margin-top: 0px;
        margin-right: 0px;
      margin-bottom: 0px;
}
.style1 {color: #ECE9D8}
-->
</style><body bgcolor="#000000"></body>
<span class="style1"></span>
<?php
include("menu.php");
echo "<table width='80%' align='center' height='100%' border='1' cellpadding='0' cellspacing='0'>";
echo "   <tr>
       <td width='30' valign='top' bgcolor='#000000'><table bgcolor='#999999' border='1'><td>
         <FONT color='white' face='Verdana, Arial, Helvetica, sans-serif' size='2'><u>Are you a member?</u></font>
         <p>
         <!-- form for customer login -->
         <form action='index.php?do=login' method='POST'>
         <table border='0'>";
                                                  #25
            if (isset($message))
                        {
             echo "<tr><td colspan='2'>$message </td></tr>";
}

          echo " <tr><td align=right><FONT color='white' face='Verdana, Arial, Helvetica, sans-serif' size='2'>Username</font></td>
             <td><input type='text' name='fusername'
                      size='20' maxsize='30'>
             </td></tr>
           <tr><td align='right'><FONT color='white' face='Verdana, Arial, Helvetica, sans-serif' size='2'>Password</font>
             </td>
             <td><input type='password' name='fpassword'
                        size='20' maxsize='30'></td></tr>
           <tr><td align='center' colspan='2'>
             <input type='submit' name='log'
                           value='Enter'></td></table></td>
           </tr>
         </table>
         </form>";
              echo "<table width='100%' bgcolor='gray'><td><font color='white' face='Verdana, Arial, Helvetica, sans-serif' size='4'><b><center><u>News</u></center></b><td></table>";
       
 
  $connection = mysql_connect($host,$user,$password)    #13
       or die ("couldn't connect to server");
  $db = mysql_select_db($database,$connection)          #15
       or die ("Couldn't select database");


  $query = "SELECT * FROM news ORDER BY id DESC LIMIT 5";    #19
  $result = mysql_query($query)
       or die ("Couldn't execute query.");


  while ($row = mysql_fetch_array($result))             #37
  {
     extract($row);                                     #39


echo "<font color='white' face='Verdana, Arial, Helvetica, sans-serif' size='2'><b>$title</b><br>"; echo substr ($post, 0, 115); echo ".....<br><font align='right'><a href='news.php?news=$id'><font color='#CCCCCC'>Full Story</font></a></font><br><br>
</font>";

}
      echo "</td>";   
        ?>
<td valign="top"><table bgcolor="#999999" width='100%' border="1"><td>
<font color='white' face='Verdana, Arial, Helvetica, sans-serif'>
<center><b><h1>Simulacra and Simulation Media</h1></b></center>
</font>
</td>
</table>
<font color='white' face='Verdana, Arial, Helvetica, sans-serif' size="2">
<br>
Welcome to Sim and Sim.com?s Media Section, here amongst other things are;<br>
Trailers made by Fans of Movies and Games<br>
Fan based movies<br>
Movie Reviews made by fans<br>
Trailers for Movies and Games that are about to be released<br>
DVDs news posted by members of this site<br>
Pictures made by members of this site
<br><br><br><br>
[b]<?php 
  $connection = mysql_connect($host,$user,$password)    #13
       or die ("couldn't connect to server");
  $db = mysql_select_db($database,$connection)          #15
       or die ("Couldn't select database");

  /* Select all categories from GameType table */
  $query = "SELECT * FROM people";    #19
  $result = mysql_query($query)
       or die ("Couldn't execute query.");              #21
         
                /* Create form containing selection list */

      echo "<center><table cellpadding='5' border='1'>";

      echo "<tr>";

      $row = mysql_fetch_array($result);
      extract($row);
    if ($_GET["find"] == $person )
      {

             $per_row = 4;
                          echo "$person";
                   $result2 = mysql_query("SELECT pic FROM pics");
             for ($i=0; $i<mysql_num_rows($result2); $i++)

              {
 
             $pic2 = mysql_result($result2,($i));

              echo "<td align='center'><img src='$pic2'></td>";

             if ($i%$per_row == 0)
                                  {
                      echo "</tr><tr>";
                                      }
             }
      }
       
    else {
         echo "<font face='Verdana, Arial, Helvetica, sans-serif' size='2'>Sorry no pics found</font>";
                  }

      echo "</tr><center></table>";                            #55

  echo "<div align='center'>
        <table border='1' bgcolor='#999999'><td><a href='media.php'>
               <font color='white' face='Verdana, Arial, Helvetica, sans-serif' size='2'>Back to the Start</font></a></td></table></div>";
?>[/b]


</td>
</table>
</body>
</html>


The Tables are:

people:
id person section
ie: 1 Username Pictures

pics
id person section pic
ie: 1 Username Pictures http://imageplace.com/images.jpg

For each pic the user has there is a new row for it, so the person who is on the site can have as many lines as s\he likes
I know its long but..... it needs to be like that

View user's profile Send private message Visit poster's website

Reply with quote
Post  
The problem is caused by the IF statement. Your SQL query will return every record from the table but the extract() function will only extract the variables from the first record. What you should do instead is find which record you care about, then only get that.

Looking at your code it seems that you haven't thought things through very well.

Check if $_GET["find"] is set using
Code:
if (isset($_GET["find"]))
Then get only that record.
Code:
$result = mysql_query("SELECT * from `people` WHERE person = '".mysql_escape_string($_GET["find"])."'";
Then you need error checking to see if that person was found (using mysql_num_rows() will do the trick).

It's almost easier starting from scratch. Say exactly what you want. Here's what I gathered. You want it so a name can be passwed in the query. If a name is passed you want to find all images in your database related to that person. You then want those images echoed out into a table which has 4 images across and as many rows as are requied. is that right?

For that you only need one table, called `pics`. Get the username, then SELECT `pic` FROM pics WHERE person='".mysql_escape_string($_GET['find'])."'. That will only return the urls of the images regarding that person. Then loop through that $result (again using mysql_num_rows) and echo the image. OK, that most likely didn't help you much so I'll try and code it myself. Note that this code is totally untested.

Code:
...
<?php
$connection = mysql_connect($host,$user,$password)
  or die ("couldn't connect to server");
$db = mysql_select_db($database,$connection)
  or die ("Couldn't select database");

echo "<center><table cellpadding='5' border='1'>";
echo "<tr>";

if (isset($_GET['find']))
{
    $per_row = 4;
    echo "Person: ".htmlentities($_GET['find']);
    $result = mysql_query("SELECT pic FROM pics WHERE person='".mysql_escape_string($_GET['find'])."'");
    for ($i=0; $i<mysql_num_rows($result); $i++)
    {
        $pic = mysql_result($result,($i));
        echo "<td align='center'><img src='$pic'></td>";
        if ($i%$per_row == 0)
        {
            echo "</tr><tr>";
        }
    }
}

else
{
    echo "<font face='Verdana, Arial, Helvetica, sans-serif' size='2'>Sorry no pics found</font>";
}

echo "</tr><center></table>";
echo "<div align='center'>
<table border='1' bgcolor='#999999'><td><a href='media.php'>
<font color='white' face='Verdana, Arial, Helvetica, sans-serif' size='2'>Back to the Start</font></a></td></table></div>";
?>
</td>
</table>
</body>
</html>


View user's profile Send private message Visit poster's website MSN Messenger

Reply with quote
Post  
THANK YOU SOOOOO MUCH!!!!
IT WORKS!!!!!
White Acid you are the greatest

View user's profile Send private message Visit poster's website
Display posts from previous:
Reply to topic Page 1 of 1
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
  



Google

FireFox! The PHP Forum Loans and Credit
Panama Web Design for Hire Free Insurance Quotes!
Web Hosting Advertise Here $10 a Month Designer Children
Never Pay Taxes Again HGH Domain name registration
Web Hosting and Dedicated Servers Insurance Affordable web-hosting


Web Design by PlatinumShore.com & Web Hosting by TradeWebHosting.com