Jump to content

sabo86

Members
  • Posts

    37
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

sabo86's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I got the same problem.. when you click on the last page, it's blank!!! what's the solution?
  2. Hello guys.. I am just trying the page limiting code for mysql results.. and here is the code.. # <?php $server = "localhost"; # $user = "root"; # $pass = "password"; # $databasename = "fleifel"; # $db = mysql_connect($server, $user); # mysql_select_db($databasename,$db); # # $sql = "SELECT * FROM items "; # $query = mysql_query($sql,$db); # $total_results = mysql_num_rows($query); # $limit = "3"; //limit of archived results per page. # $total_pages = ceil($total_results / $limit); //total number of pages # if (empty($page)) # { # $page = "1"; //default page if none is selected # } # $offset = ($page - 1) * $limit; //starting number for displaying results out of DB # # $query = "SELECT * FROM items LIMIT $offset, $limit"; # $result = mysql_query($query); # //This is the start of the normal results... # # while ($row = mysql_fetch_array($result)) # { # // display your results as you see fit here. # } # mysql_close(); # # # // This is the Previous/Next Navigation # echo "<font face=Verdana size=1>"; # echo "Pages:($total_pages) "; // total pages # if ($page != 1) # { # echo "<a href=$PHP_SELF?page=1><< First</a> "; // First Page Link # $prevpage = $page - 1; # echo " <a href=$PHP_SELF?page=$prevpage><<</a> "; // Previous Page Link # } # if ($page == $total_pages) # { # $to = $total_pages; # } # elseif ($page == $total_pages-1) # { # $to = $page+1; # } # elseif ($page == $total_pages-2) # { # $to = $page+2; # } # else # { # $to = $page+3; # } # if ($page == 1 || $page == 2 || $page == 3) # { # $from = 1; # } # else # { # $from = $page-3; # } # # for ($i = $from; $i <= $to; $i++) # # { # if ($i == $total_results) $to=$total_results; # if ($i != $page) # { # echo "<a href=$PHP_SELF?showold=yes&page=$i>$i</a>"; # } # else # { # echo "<b><font face=Verdana size=2>[$i]</font></b>"; # } # if ($i != $total_pages) # echo " "; # } # if ($page != $total_pages) # { # $nextpage = $page + 1; # echo " <a href=$PHP_SELF?page=$nextpage>>></a> "; // Next Page Link # echo " <a href=$PHP_SELF?page=$total_pages>Last >></a>"; // Last Page Link # } # echo "</font>"; # ?> I got the following result: # Pages:(2) [1] Notice: Undefined variable: PHP_SELF in C:\Program Files\EasyPHP 2.0b1\www\test fleifel\example.php on line 141 2 Notice: Undefined variable: PHP_SELF in C:\Program Files\EasyPHP 2.0b1\www\test fleifel\example.php on line 165 >> Notice: Undefined variable: PHP_SELF in C:\Program Files\EasyPHP 2.0b1\www\test fleifel\example.php on line 167 Last >> What is the problem?
  3. The while loop worked... but the results are as following: 1.Model : Executive Office Arco Description: Executive offices wooden frames anthracite lacquered; worktops, doors and drawer-fronts. Category: European Office Furniture 2.Model : MOD. SERIE 2000 Description: Work Station Category: Local Office Furniture 1.Model : MOD.098 Description: Anthropornetric desk Category: School and University Furniture 2.Model : Operative Seatings T Description: I love this descript Category: Seatings In other words, the numerations are 1 & 2 only!!! how can this be solved? here is the code again: $i=0; while ($row = mysql_fetch_array($result)) { echo '<table width="800" border="0">'; if( $i = $i%2 ) { echo ' <tr bgcolor="#EFEFEF">';} else { echo ' <tr bgcolor="#D3D3D3">'; }; echo '<td width="68" align="left" valign="top"><div align="left"><a href="'.$row["Picture"].'" target="_blank"><img src="'.$row["PictureThumbnail"].'" border="0" /></a></td>'; echo " <td><strong> ".($i+1).".Model : </strong>"; echo htmlspecialchars(stripslashes($row["Model"])); echo "<br><strong> Description: </strong>" ; echo htmlspecialchars (stripslashes($row["Description"])); echo "<br><strong> Category: </strong>"; echo htmlspecialchars (stripslashes($row["Category"])); echo "<br></td></table>";$i++; } Thanks much
  4. but the for loop was working before I put the if condition? what do you think the problem is?
  5. but i want to use the for loop inorder to make different row background colors! Besides I need to numerate the results
  6. This one may make it more clear $num_results = mysql_num_rows($result); echo "<p><i>Number of records found: ".$num_results."</i></p>"; $Model = $Description = $Category = $Image = null; for ($i=0; $i <$num_results; $i++){ $row = mysql_fetch_array($result); echo '<table width="800" border="0">'; if( $i = $i%2 ) { echo ' <tr bgcolor="#EFEFEF">';} else { echo ' <tr bgcolor="#C3C3C3">'; }; echo '<td width="68" align="left" valign="top"><div align="left"><a href="'.$row["Picture"].'" target="_blank"><img src="'.$row["PictureThumbnail"].'" border="0" /></a></td>'; echo " <td><strong> ".($i+1).".Model : </strong>"; echo htmlspecialchars(stripslashes($row["Model"])); echo "<br><strong> Description: </strong>" ; echo htmlspecialchars (stripslashes($row["Description"])); echo "<br><strong> Category: </strong>"; echo htmlspecialchars (stripslashes($row["Category"])); echo "<br></td></table>"; }
  7. hello guys here part of my code: for ($i=0; $i <$num_results; $i++){ $row = mysql_fetch_array($result); echo '<table width="800" border="0">'; if( $i = $i%2 ) { echo ' <tr bgcolor="#EFEFEF">';} else { echo ' <tr bgcolor="#C3C3C3">'; } echo '<td width="68" align="left" valign="top"><div align="left"><a href="'.$row["Picture"].'" target="_blank"><img src="'.$row["PictureThumbnail"].'" border="0" /></a></td>'; echo " <td><strong> ".($i+1).".Model : </strong>"; echo htmlspecialchars(stripslashes($row["Model"])); echo "<br><strong> Description: </strong>" ; echo htmlspecialchars (stripslashes($row["Description"])); echo "<br><strong> Category: </strong>"; echo htmlspecialchars (stripslashes($row["Category"])); echo "<br></td></table>"; } The results seems to be infinite loop of rows that doesn't end... any suggestions?
  8. one more question before i try the automated thing.. I created an attribute for the thumbnail... and Now i have the following result .. and i want to make it in this way: http://img382.imageshack.us/my.php?image=res2kn9.jpg How can I edit my code?
  9. I know graphic design, but haven't heard about an automated way as a programming way!
  10. isn't there is another way of resizing the same picture..
  11. btw, is there anyway that makes this image a thumbnail in a way i can click it to get the actual size?
  12. thanks wildteen88 for your help.. it really works!! I appreciate
  13. I have this code now (I've been editing it thousands times ) for ($i=0; $i <$num_results; $i++){ $row = mysql_fetch_array($result); echo " <p><strong>".($i+1).".Model: </strong>"; echo htmlspecialchars(stripslashes($row["Model"])); echo "<br><strong> Description: </strong>" ; echo htmlspecialchars (stripslashes($row["Description"])); echo "<br><strong> Category: </strong>"; echo htmlspecialchars (stripslashes($row["Category"])); echo "<br><strong> Image: </strong>"; echo $row["Picture"];} How can I retrieve the image and display it in the correct place? I've heard that storing them in blob format will exhaust mysql..
  14. Ok.. well.. I want simply to display the database's records in a neat table so that it would be compatible with my layout that i will design later on
×
×
  • 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.