FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


PHP Help Needed





Simulator
Can anyone here see anything wrong with this, it shows Pics that are in my database, (connection not shown), it shows different pics on a different page for different people, the $person is the persons name that is shown in the url like show.php?find=Erik, the only problem is is that it only shows Eriks, and will not show anyone elses. Anyone got any ideas



Code:

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

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

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

              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>";
         }
mathiaus
Glancing over very briefly...

if you are getting the error
'Sorry no pics found'
I suggest you go through the script and find where $person is. My guess is that somewhere you have $person=Erick or something similar.

If thats not it I'll have a deeper look when I can.

Matt
Simulator
Sorry I meant to say that, the extract($row); bit is where it takes $row(which is the only part of the MySQL connection shown) and turns all its content into variables
Antoine_935
( just for me ) line 3 : @ before a variable, I've never seen that. does the expression $_GET['smtg'] return an error if smtg doesn't exist ?
Simulator
The @ gets the ?find=$person from the URL
Antoine_935
mmmh, a simple $_GET[' '] without @ does the same, so, what is the @ used for ?
Simulator
Hmm It does......, still didn't fix it tho, it only shows the first persons who has pics in my database
Antoine_935
SELECT pic,person FROM pics WHERE person='$person'

You will only select pics from one person, because $_GET['find'] contains only one name.
if you want to select all pics in one time, then
SELECT pic,person FROM pics
Simulator
When the url is online its like show.php?find=Erik or show.php?find=kv007, and when I take it away it shows all the pics from all the different people, have you got a MSN?
Related topics
Help Needed Regarding CGI And Php
mysql/php help please
phpBB - Installation Tutorial
CSS Help needed : Table emulation with divs
A Bit Of Help Needed :P
[php/SQL] Help needed
Need some php help.
PHP Help
Uplaoding images using php form :::: Help needed
PHP Read File Help needed.
Big Help needed .
Help needed with images in php include files
No icons on backend??
php project help needed please
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.