Jump to content

sheriff

Members
  • Posts

    49
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

sheriff's Achievements

Member

Member (2/5)

0

Reputation

  1. Thanks for help ! That was the problem ..
  2. hi all ... I have tryed to adapt a php navigation to my page. it's almost ok, but I have a little problem. it shows me the first page ok, but when I click next, the page is empthy. I don't know why. Maybe someone can help me ! this is the code: <?php // how many rows to show per page $rowsPerPage = 20; // by default we show first page $pageNum = 1; // if $_GET['page'] defined, use it as page number if(isset($_GET['page'])) { $pageNum = $_GET['page']; } // counting the offset $offset = ($pageNum - 1) * $rowsPerPage; // remove white spaces befor and after the word // $trimmed = trim($_REQUEST['search']); $query = "[b]SELECT * FROM products WHERE pr_type='$_REQUEST[id]' LIMIT $offset, $rowsPerPage[/b]"; $result = mysql_query($query) or die("Query failed: $query<br /><br />mysql_error()"); $row_count = "1"; $color1 = "#DDDDDD"; $color2 = "#CCCCCC"; // print the random numbers while($val = mysql_fetch_array($result)) { $row_color = ($row_count % 2) ? $color1 : $color2; ?> <tr> <td bgcolor="<?php echo $row_color; ?>" align="center" width="30"><span class="cn_text"><?php echo $val['pr_id']; ?></span></td> <td width="150" bgcolor="<?php echo $row_color; ?>"><span class="cn_text"> <?php echo $val['pr_name']; ?></span></td> <td width="200" bgcolor="<?php echo $row_color; ?>"><span class="cn_text"> <?php echo $val['pr_desc']; ?></span></td> <td align="center" bgcolor="<?php echo $row_color; ?>"><span class="cn_text"><?php echo $val['pr_price']; ?> RON</span></td> </tr> <?php //echo "$val <br>"; //echo $id = $val['pr_id']; $row_count++; } ?> </table><br> <?php // how many rows we have in database $query = "[b]SELECT COUNT(*) AS numrows FROM products WHERE pr_type='$_REQUEST[id]'[/b]"; $result = mysql_query($query) or die('Error, query failed'); $row = mysql_fetch_array($result, MYSQL_ASSOC); $numrows = $row['numrows']; // how many pages we have when using paging? $maxPage = ceil($numrows/$rowsPerPage); $self = $_SERVER['PHP_SELF']; // creating 'previous' and 'next' link // plus 'first page' and 'last page' link // print 'previous' link only if we're not // on page one if ($pageNum > 1) { $page = $pageNum - 1; $prev = " [<a href=\"$self?page=$page\"><span class=\"cnb_text\">Inapoi</span></a>] "; $first = " [<a href=\"$self?page=1\"><span class=\"cnb_text\">Prima pagina</span></a>] "; } else { $prev = ' [<span class=\"cn_text\">Inapoi</span>] '; // we're on page one, don't enable 'previous' link $first = ' [<span class=\"cn_text\">Prima Pagina</span>] '; // nor 'first page' link } // print 'next' link only if we're not // on the last page if ($pageNum < $maxPage) { $page = $pageNum + 1; $next = " [<a href=\"$self?page=$page\"><span class=\"cnb_text\">Inainte</span></a>] "; $last = " [<a href=\"$self?page=$maxPage\"><span class=\"cnb_text\">Ultima Pagina</span></a>] "; } else { $next = ' [<span class=\"cn_text\">Inainte</span>] '; // we're on the last page, don't enable 'next' link $last = ' [<span class=\"cn_text\">Ultima Pagia</span>] '; // nor 'last page' link } // print the page navigation link echo "<span class=\"cn_text\">" . $first . $prev . " Pagina <strong>$pageNum</strong> din <strong>$maxPage</strong> " . $next . $last . "</span>"; ?> This is the page. http://cristi.prosportequipment.ro/prosportnew/produse.php?id=1 Thanks in advice.
  3. thanks for the idea. I will try to see if it's possible. thanks again !
  4. ok .. I found the problem ... I don't know it's a good method, but in this way is work! Please tell me if it's ok ... Thanks for help. if ($pageNum > 1) { $page = $pageNum - 1; $prev = " <a href=\"$self?page=$page&search=$_REQUEST[search]&category=$_REQUEST[category]\">[Prev]</a> "; $first = " <a href=\"$self?page=1&search=$_REQUEST[search]&category=$_REQUEST[category]\">[First Page]</a> "; } else { $prev = ' [inapoi] '; // we're on page one, don't enable 'previous' link $first = ' [Prima Pagina] '; // nor 'first page' link } // print 'next' link only if we're not // on the last page if ($pageNum < $maxPage) { $page = $pageNum + 1; $next = " <a href=\"$self?page=$page&\">[inainte]</a> "; $last = " <a href=\"$self?page=$maxPage\">[ultima Pagina]</a> "; } else { $next = ' [Next] '; // we're on the last page, don't enable 'next' link $last = ' [Last Page] '; // nor 'last page' link } if ($pageNum > 1) { $page = $pageNum - 1; $prev = " <a href=\"$self?page=$page\">[Prev]</a> "; $first = " <a href=\"$self?page=1\">[First Page]</a> "; } else { $prev = ' [inapoi] '; // we're on page one, don't enable 'previous' link $first = ' [Prima Pagina] '; // nor 'first page' link } // print 'next' link only if we're not // on the last page if ($pageNum < $maxPage) { $page = $pageNum + 1; $next = " <a href=\"$self?page=$page&search=$_REQUEST[search]&category=$_REQUEST[category]\">[inainte]</a> "; $last = " <a href=\"$self?page=$maxPage&search=$_REQUEST[search]&category=$_REQUEST[category]\">[ultima Pagina]</a> "; } else { $next = ' [Next] '; // we're on the last page, don't enable 'next' link $last = ' [Last Page] '; // nor 'last page' link }
  5. it seems he not remember the $search on the next page !
  6. if I use frames, the google don't index my page. If I know well.
  7. ok .. but how ? because, if I click on a link, i am redirected to that page ? no ? You know some script what can solve this problem ? thx
  8. nope.. it not work ... try to make a search where you have two page as result .. make a search for a code and enter 1 as search word. thanks !
  9. hi .. if i have a flash menu ... with a little animation, it is possible to include it in every page but just in the first page to play, not on every page where the guest enter to replay the flash ? thanks .
  10. Hi ... I try to make a search in database, but with the results on multiple pages... sorry for my english .. so .. this code is work somehow, but if i click on next, the next page is empty and the "Error, query failed" is displayed. Please help a noob to solve this problem this is the page: http://cristi.amirb.net/ivanyi.com/oferta.php this is the search <form method="post" action="search.php" name="search"> <table border="0" cellpadding="1" cellspacing="1"> <tr> <td align="center" valign="middle"> <input type="radio" name="category" value="pr_code" checked> <span class="cn_text">Cod</span> <input type="radio" name="category" value="pr_name"> <span class="cn_text">Name</span></td> </tr> <tr> <td> <input type="text" name="search" size="40" style="background-color: #CCCCCC; border-width:thin"> </td> <td><input type="submit" name="submit" value="Cauta"> </td> </tr> </table> </form> and this is the result page <?php echo "Cuvant cautat: ".$_REQUEST['search']." din categoria ".$_REQUEST['category']."."; ?> <br> <table border="1" cellpadding="1" cellspacing="1"> <tr> <td bgcolor="#000000" align="center"><span class="cb_text">Nr.Crt.</span></td> <td bgcolor="#000000" align="center"><span class="cb_text">Cod</span></td> <td bgcolor="#000000" align="center"><span class="cb_text">Nume</span></td> <td bgcolor="#000000" align="center"><span class="cb_text">Descriere</span></td> </tr> <?php // how many rows to show per page $rowsPerPage = 5; // by default we show first page $pageNum = 1; // if $_GET['page'] defined, use it as page number if(isset($_GET['page'])) { $pageNum = $_GET['page']; } // counting the offset $offset = ($pageNum - 1) * $rowsPerPage; // remove white spaces befor and after the word // $trimmed = trim($_REQUEST['search']); $query = "SELECT * FROM products WHERE $_REQUEST[category] LIKE '%$_REQUEST[search]%' LIMIT $offset, $rowsPerPage"; $result = mysql_query($query) or die('Error, query failed'); $row_count = "1"; $color1 = "#DDDDDD"; $color2 = "#CCCCCC"; // print the random numbers while($val = mysql_fetch_array($result)) { $row_color = ($row_count % 2) ? $color1 : $color2; ?> <tr> <td bgcolor="<?php echo $row_color; ?>" align="center" width="30"><span class="cn_text"><?php echo $row_count++; ?></span></td> <td width="40" bgcolor="<?php echo $row_color; ?>"><span class="cn_text"> <?php echo $val['pr_code']; ?></span></td> <td width="150" bgcolor="<?php echo $row_color; ?>"><span class="cn_text"> <?php echo $val['pr_name']; ?></span></td> <td width="200" bgcolor="<?php echo $row_color; ?>"><span class="cn_text"> <?php echo $val['pr_desc_tech']; ?></span></td> </tr><tr> <td colspan="5" bgcolor="<?php echo $row_color; ?>"><span class="cn_text">Descriere: <?php echo $val['pr_desc_expl']; ?></span></td> </tr> <?php //echo "$val <br>"; //$id = $val['pr_id']; } ?> </table><br> <?php // how many rows we have in database //$query = "SELECT COUNT('$val[pr_id]') AS numrows FROM products"; //$result = mysql_query($query) or die('Error, query failed'); //$row = mysql_fetch_array($result, MYSQL_ASSOC); $numrows = $row_count++; // $row['numrows']; // how many pages we have when using paging? $maxPage = ceil($numrows/$rowsPerPage); $self = $_SERVER['PHP_SELF']; // creating 'previous' and 'next' link // plus 'first page' and 'last page' link // print 'previous' link only if we're not // on page one if ($pageNum > 1) { $page = $pageNum - 1; $prev = " <a href=\"$self?page=$page\">[Prev]</a> "; $first = " <a href=\"$self?page=1\">[First Page]</a> "; } else { $prev = ' [inapoi] '; // we're on page one, don't enable 'previous' link $first = ' [Prima Pagina] '; // nor 'first page' link } // print 'next' link only if we're not // on the last page if ($pageNum < $maxPage) { $page = $pageNum + 1; $next = " <a href=\"$self?page=$page\">[inainte]</a> "; $last = " <a href=\"$self?page=$maxPage\">[ultima Pagina]</a> "; } else { $next = ' [Next] '; // we're on the last page, don't enable 'next' link $last = ' [Last Page] '; // nor 'last page' link } // print the page navigation link echo $first . $prev . " Pagina <strong>$pageNum</strong> din <strong>$maxPage</strong> pagini " . $next . $last; ?> thanks !
  11. I solved it somehow ... <html> <head> <script> function on(i) { document.getElementById(i).className="show"; } function off(i){ document.getElementById(i).className="hide"; } </script> </head> <body> .... php/mysql stuff .... <tr> <td align="center" width="30"><span class="cn_text"><?php echo $row_nr++; ?></span></td> <td width="40" <span class="cn_text"> <?php echo $row['pr_code']; ?></span></td> <td width="150" onmouseover="on('<?php echo $row['pr_id']; ?>')" onmouseout="off('<?php echo $row['pr_id']; ?>')"><span class="cn_text"> <?php echo $row['pr_name']; ?> </span></td> <td width="200" bgcolor="<?php echo $row_color; ?>"><span class="cn_text"> <?php echo $row['pr_desc_tech']; ?></span></td> <td <span class="cn_text"> <?php echo $row['pr_price']; ?> RON</span></td></tr> <tr id="<?php echo $row['pr_id']; ?>"> <td colspan="5" bgcolor="<?php echo $row_color; ?>"><span class="cn_text"> <?php echo $row['pr_desc_expl']; ?></span></td> </tr> <?php } ?> </table> </body> Thanks anyway for help !
  12. Hi all .. can anyone help me out with this ? I have a php generated table. ---------------------------- | | row 1 | onclick on row1 shows up description 1, oncick again on row1, hide description 1. ---------------------------- | | description row 1 | ---------------------------- | | row 2 | ---------------------------- | | description row 2 | ---------------------------- | | row 3 | ---------------------------- | | description row 3 | ---------------------------- | I want something with onClick="showhide(???)" by <td id="<?php echo row['pr_id'] ?>"> a similar style is at http://isohunt.com/torrents/?ihq=Joe+Satriani thanks for help!
  13. hi all ... I have make a nav.html file with links ... and i want this to appear on all pages. i know the include() function, and is great. but if i change the dir .. for exemple .. /admin/ the link must be with "../" in front of the url. how is the best way to do a navigation menu ? please tel me links, or docs .. Thank you very much! The n00b
  14. The solution is: $query = "SELECT prod_com.pr_id, prod_com.ord_nr, prod_com.cmd_id, prod_com.pr_qty, sum(prod_com.pr_qty) AS total_quantity FROM prod_com GROUP BY prod_com.pr_id"; the reference: http://www.thescripts.com/forum/thread647763.html Very cool thing !
×
×
  • 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.