sabo86
Members-
Posts
37 -
Joined
-
Last visited
Never
Everything posted by sabo86
-
I got the same problem.. when you click on the last page, it's blank!!! what's the solution?
-
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?
-
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
-
but the for loop was working before I put the if condition? what do you think the problem is?
-
but i want to use the for loop inorder to make different row background colors! Besides I need to numerate the results
-
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>"; }
-
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?
-
any help plz?
-
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?
-
I know graphic design, but haven't heard about an automated way as a programming way!
-
isn't there is another way of resizing the same picture..
-
btw, is there anyway that makes this image a thumbnail in a way i can click it to get the actual size?
-
thanks wildteen88 for your help.. it really works!! I appreciate
-
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..
-
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
-
Now my code is: $Model .= '<td>'.$row['Model'].'</td>'; $Description .= '<td>'.$row['Description'].'</td>'; $Category .= '<td>'.$row['Category'].'</td>'; $Image .= '<td>'.$row['Picture'].'</td>'; } for ($i=0; $i <$num_results; $i++) { ?> <table> <tr><td><?php echo "<br><p><strong>".($i+1).". Model:"; ?></td><?=$Model?></tr> <tr><td><?php echo "<strong> Description:"; ?></td><?=$Description?></tr> <tr><td><?php echo "<strong> Category:"; ?></td><?=$Category?></tr> <tr><td><?php echo "<strong> Picture:"; ?></td><?=$Image?></tr> <?php } and results are like: Number of records found: 4 1. Model: Description: Category: Picture: 2. Model: Description: Category: Picture: 3. Model: Description: Category: Picture: 4. Model: Description: Category: Picture: How can I get the records in these attributes?
-
ok i got Fleifel Notice: Undefined variable: field in C:\Program Files\EasyPHP 2.0b1\www\test fleifel\results.php on line 54 Number of records found: 4 1Model 1Description 1Category 1Picture 2Model 2Description 2Category 2Picture 3Model 3Description 3Category 3Picture 4Model 4Description 4Category 4Picture But I am not getting the results from the database.. just the atribute names...
-
OK I tried this one, the results are as following: Notice: Undefined variable: field in C:\Program Files\EasyPHP 2.0b1\www\test fleifel\results.php on line 54 Number of records found: 4 Notice: Undefined variable: Model in C:\Program Files\EasyPHP 2.0b1\www\test fleifel\results.php on line 77 Notice: Undefined variable: Description in C:\Program Files\EasyPHP 2.0b1\www\test fleifel\results.php on line 78 Notice: Undefined variable: Category in C:\Program Files\EasyPHP 2.0b1\www\test fleifel\results.php on line 79 Notice: Undefined variable: Image in C:\Program Files\EasyPHP 2.0b1\www\test fleifel\results.php on line 80 1Model 1Description 1Category 1Picture 2Model 2Description 2Category 2Picture 3Model 3Description 3Category 3Picture 4Model 4Description 4Category 4Picture
-
it didn't work as well.. the same error!
-
Didn't work error: Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in C:\Program Files\EasyPHP 2.0b1\www\test fleifel\results.php on line 77
-
I didn't get your point? would you plz explain?
-
I am trying to display my results, I tried this way: echo "<p>Number of records found: ".$num_results."</p>"; while ($row = mysql_fetch_array($result)){ $Model.="<td>$row['Model']</td>"; $Description.="<td>$row['Description']</td>"; $Category.="<td>$row['Category']</td>"; $Image.="<td>$row['Picture']</td>"; } for ($i=0; $i <$num_results; $i++) { <table> <tr><td>echo "<p><strong>.($i+1).".Model</td><?=$Model</tr> <tr><td>echo "<p><strong>.($i+1).".Description</td><?=$Description</tr> <tr><td>echo "<p><strong>.($i+1).".Category</td><?=$Category</tr> <tr><td>echo "<p><strong>.($i+1).".Picture</td><?=$Image</tr> } but i got this error: Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in C:\Program Files\EasyPHP 2.0b1\www\test fleifel\results.php on line 76 What's the problem?
-
here is part of my code if($_POST['searchtype']=='Seatings') $field='Seatings'; elseif ($_POST['searchtype']=='Accessories') $field='Accessories'; elseif ($_POST['searchtype']=="Local Office Furniture") $field='Local Office Furniture'; elseif ($_POST['searchtype']=="European Office Furniture") $field='European Office Furniture'; elseif ($_POST['searchtype']=="School and University Furniture") $field='School and University Furniture'; $query = "select * FROM items where Category = '$field' order by Model" ; $query2="select * FROM items order by Model"; if ($_POST['searchtype']=='All') {$result = mysql_query($query2)or trigger_error(mysql_error().'<br />Query was:'.$sql,E_USER_ERROR); ;} else $result = mysql_query($query)or trigger_error(mysql_error().'<br />Query was:'.$sql,E_USER_ERROR); ; $num_results = mysql_num_rows($result); echo "<p>Number of records found: ".$num_results."</p>"; When I select "All" from the drop menu, I am getting the following result: Notice: Undefined variable: field in C:\Program Files\EasyPHP 2.0b1\www\test fleifel\results.php on line 53 Number of records found: 4 1.Model:Executive Office Arco Description:Executive offices wooden frames anthracite lacquered; worktops, doors and drawer-fronts. Category: European Office Furniture Image: 2.Model:MOD. SERIE 2000 Description:Work Station Category: Local Office Furniture Image: 3.Model:MOD.098 Description:Anthropornetric desk Category: School and University Furniture Image: http://localhost/test%20fleifel/desk.JPG 4.Model:Operative Seatings T Description:I love this descript Category: Seatings Image: http://localhost/test%20fleifel/desk.JPG The results are right, but why is the NOTICE thing is displayed?
-
Thanks a lot
-
if($_POST['searchtype']="Accessories") $field='Accessories'; elseif ($_POST['searchtype']="Seatings") $field='Seatings'; elseif ($_POST['searchtype']="Local Office Furniture") $field='Local Office Furniture'; elseif ($_POST['searchtype']="European Office Furniture") $field='European Office Furniture'; elseif ($_POST['searchtype']="School and University Furniture") $field='School and University Furniture'; $query = "select * FROM items where Category = '$field'"; Just wondering why $field is always taking the string 'Accessories'? knowing that searchtype is the drop menu form..??