Show 20 Results Per Page
i have created a database with some data in it and i want my page to read page and display the first 20 results and on the bottom to add numbers like [1] [2] [3] so the user can go to the next results.I figured that i can display the first 20 results by adding a counter on the while loop
$num_rows = mysql_num_rows($result);
$k=0;
     while (($k<=20)&&($row = mysql_fetch_row($result))){
$k+=1;
$i+=1;but i don't know how to display the numbers on the bottom.Here is my try
<?php for($j=1;$j<=($num_rows/20);$j+=1){
  echo "[".$j."]";
}Â ?> ...
View Complete Forum Thread with Replies
Related Forum Messages:
How Do I Show Results Of A Query
I know how to connect to a Mysql table. I want to run the query and show the results on my page. I'll have about 25 different fields I need to show on the page. Most of this information will be a couple of addresses. Basically, a billing and then a shipping address. Can someone show me how to show some of this on a page? I'll need to align all this stuff around the page.
View Replies !
Don't Show Results From Database If ID Is...
I know I have to use regex for this but I'm a complete noob at regex and I must have it ready by tomorrow! So any help will be greatly appreciated. What I would like is that if the script finds an ID with dots in it, followed by a character or a number (like this Κ600.33.029.01) it won't show at the results page.
View Replies !
Show Three Random Results
I have a table with quite a few entries in it. Part of the new layout of my homepage needs to call the entries to preview them. How could I make it get all the ID's (field name: ID) and select three random ones? What I have to preview them so far is: PHP Code: <?php $con = mysql_connect($server,$user,$pass); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db($db_name, $con); $result = mysql_query("SELECT * FROM portfolio"); while($row = mysql_fetch_array($result)) { echo "<center><h3>".$row['title']."</h3>"; echo "<img height="100" width="100" src="".$row['image_path']."" /><br />";
View Replies !
Mysql Show Results
I have a simple survey with a drop down that lets users select different depts in our organization. Displaying the results to a different page works fine, but I would like to create another, same looking, drop down on our results page that lets you view only the results for the selected dept. Or, if it would be easier to do it via hyperlinks.
View Replies !
Show Form Results Only If A Value
I have this function that works great and displays the results of a form submission to a user. But it works so well it shows all fields even if nothing has been selected. Is there a way to fix this so if the field value is null then don't show? Code:
View Replies !
Show Results If Ip = $_GET[REMOTE_ADDR]
i am trying to make a basic shopping cart. i have a table (shop_cart). when the member clicks add to cart the product is added to a table in my database where the members ip address is stored. what i am now trying to do is how the products in the users cart by getting the ip address. so show products where ip address is equal to the users ip address. PHP Code:
View Replies !
Links - Show The Corresponding Type In The Results
I have a DB called 'Projects' full of projects and their information and one of the fields in the table also called 'projects' is 'type', ie. House, Resort, Golf Course etc etc. So what I have is a html page with 5 links on it...each link is relevant to a 'type'. What I would like to do is call a php page that will only show the corresponding type in the results. Code:
View Replies !
How To Show Random Results But Highest Value More Often
I am attempting to figure out how to show random results, but display the highest value more often. I can't quite figure it out though this is as far as i have got. PHP Code: $sql = mysql_query("SELECT * FROM affiliates ORDER BY RAND(), referred DESC LIMIT 10"); while($result = mysql_fetch_object($sql)){ Â Â echo $result->referred."<br>"; }
View Replies !
Making The Results Of A Search Engine Show As A Link
I made a simple PHP search engine for my web site. the problem I'm having is that the results show as regular text rather then a link to the page found. I need to know how you use A HREF with a variable. below is the section of my code that I figure I need to modify. $row = mysql_fetch_array($result); echo ($i+1).'<strong> URL: ' echo stripslashes($row['url']).'</strong>' echo '<br />'
View Replies !
If Value =1 Direct To Page Otherwise Show Data On Page
In the member account area there is a button saying (list) when the member clicks this they are redirected to add.php here i am wanting to check if a members account is limited, if it is direct them to a page saying you must pay your bill. if its not display the info on the page. in the database there is a field called limited which is tiny in if its not limited the value of the field would be 0 if it is limited the value would be 1.
View Replies !
If Page = 'about' Show The About.html Page?
I wanted to do some kind of PHP script so that if the current page the viewer is trying to view is called index.php?page=about then it will use the php script to embed with an i-frame the about.html file into a cell in my web page's table. Basically, so that the whole page stays the same other than one cell of the table which is dynamic depending on the status of the index.php?page=whatever. Code:
View Replies !
Show Some And More On Next Page
I'm stuck making my log for login sessions show only 50 per page. The reason I need this is because it will only display about 250 items before not updating/displaying anymore. If anyone has a link to a tutorial, that would be super- couldnt find one via google.
View Replies !
Show When The Page Has Been Last Modified
1. I have php script that will show when the page has been last modified. How do I link it on my home page. The link that I am using now does not work. Here is the link: <? include("updatepage.php"); ?> 2. I have a php forum. When I link it this way <a href="xxxxx/index.php"> it brings up the source code. When I link it this way <a href="xxxxxx/"> it brings up the dir. When I link it this way <a href="http://xxx/xxxxx/index.php"> it works. How do I get it to work with this linking <a href="xxxxxx/index.php">
View Replies !
Flash .swf Doesn't Show In PHP Page
I've recently put together a flash navigation for a 4 page site... three pages are HTML, the index page is PHP with a weblog. In all current Mac browsers, all four pages load fine. In Win IE 6 only the .shtml pages will load the flash--the .php page shows a big white box instead. If I include the index.php in the index.shtml file, the flash loads fine, but I'd like to know if there is some issue with PHP & flash that I should look out for... or is the issue with IE 6.
View Replies !
Show Image On Same Page
I echo a certain amount of images, these images are thumbnails. I want to be able to show the real enlarged image next to the thumbnail without having to reload the page. So what i'm thinking of is something like the onclick function in JS. I tried some stuff but still can't make it work. my code is something like this: for (i=0; i<count($test); i++){ echo "<a href="...."><img src="$test[$i]"></a>"; } tried putting a javascript function in there but wasn't successful. i basically need to pass just $i to another function and that function onclick() will produce the image.
View Replies !
Show Home Page On Log In
I want to have a homepage with a log in feature. But I want it to say 'You are not logged in" or "you are logged in" depending on whatever is the case. I know how to check db entries etc but should I have the php on the same page in order to position the welcome note ie: <?php echo "<p>Welcome $_SESSION(username), to my website</p>;?>
View Replies !
How To Display "No Results" Instead Of Empty Table On Results Page
I have a search facility on my homepage for a property lettings website. There are 3 search parametres, location, rent and type (e.g. 1bed). It passes the parametres to the results.php page and displays the results in a table. When there are no results, it still displays a table, but it is empty. How do I display some text that says "No Results" instead of an empty table??
View Replies !
Show Page Depending On Request Url?
Is there any way to show a different page depending on the request url? I have a few domains that point to one IP address. What I want to do is if someone requests http://www.site1.co.uk they see site1.php or http://www.site2.co.uk they see site2.php etc all from the root directory? I do not have httpd.conf access Is this possible?
View Replies !
Show Number Of Visits On Each Page...
How should i do when I want to show number of visitor on each page where each page is describing a user details like this: http://localhost/user.php?user=1 on this page it show details about user 1. And for user_52 I want to show how many visitors this user have had: http://localhost/user.php?user=52 it will show number of visits
View Replies !
Show Error Message On Same Page
I have Index.php which contains the HTML form with a username and password field + submit button, action: is my check.php. Say for example the user only input's a username and miss out the password field; when he clicks the submit button. I want the same page to be refreshed with a error message appearing below the submit button saying "error, please fill all in". I can get this to display on another page. but want this to be on refereshed on the log-in page.
View Replies !
Show Page Break In Records
I've just started to learn php and sql, and I noticed that there are several php discussion groups here. Pardon me if this is the wrong group, and I hope my first question isn't too silly. :-) I'm building a website that will publish articles, so I have an article table which contains a heading field, an ingress field, and a body field which will hold the complete article. There are line shifts (or page breaks) in this field, but my display-page won't show them. How do I show the article with the page breaks?
View Replies !
How To Sho Video Clip On Web Page Also A Live Show On Web
Indeed I am using php and Mysql. My licent want to 1. Show a video clippings on the web site. What I need to do ? Please elaborate a n example will be great thing. 2. He also want me to show live telecast of a seminar What arrangement I ned to do From hardware point of view as well as Software point of view.
View Replies !
Page Load Time Show Really High
im running PHP 5.2 on IIS 6 (Windows 2003 Server) and im getting a weird load time result when trying to display page load times on each page. e.g. Page generated in 1193387528.5501 seconds. this is my current code: <?php $time = microtime(); $time = explode(' ', $time); $time = $time[1] + $time[0]; $finish = $time; $total_time = round(($finish - $start), 4); echo '<p>Page generated in '.$total_time.' seconds.</p>'." "; ?> but i've tried 4 others which are all simular. Any idea as to why it's showing a false result as it's loading in unde 1 second (Dual Xeon 2.8 HT server and connecting over 100mb pipe (college campus)).
View Replies !
Get A Paragraph Of Text To Show On The Home Page Only
I am using a script that I purchased and downloaded. This script has a template folder and inside has header. php, and footer.php. The center content is populated from various other pages. How would I get a paragraph of text to show on the home page only, and no other pages in the script
View Replies !
How Do I Alter This Script To Show 5 Rows Per Page?
I'm very new to php/mysql and am having a few problems I would like to show five rows of data then have a link to next five / previous etc. I've included the script I have below. I would like to add I have found articles on how to do this, but my problems is i don't knowwhere I should be editing the below code. I have tried several examples but just keep getting errors. Code:
View Replies !
Str_replace - Add Some Content On The Page To Show What You Have Submitted?
I had this wacky idea to have a pull down that keeps the same values when previewing what they have select in the post (ie. Webmaster World's 'Preview' Button When you post It has the same value of what u put in it when you add some content on the page to show what you have submitted) My Code: $genre_pulldown = "<select name="genre" id="genre"><optgroup label="Genre"><option value="Yo Mama">Yo Mama</option><option value="Blonde">Blonde</option><option value="Political">Political</option><option value="Religious">Religious</option><option value="knock Knock Jokes">knock Knock Jokes</option></optgroup></select>"; if(!isset($_POST['genre'])){ echo $genre_pulldown; } else{ $genre_pulldown = str_replace('{$_POST['genre']}"', '{$_POST['genre']}" selected', '{$genre_pulldown}');//LINE 81 }
View Replies !
Problem With Include - Register Page Doesn't Show Up
I am trying to include a page, but for some reason it is not working. Here is my code: <?php if ($page=="") { echo "<center>Starbits Pets is currently upgrading to V2, so we will be down for a while, come back later!"; } elseif ($page=register") { include ("html/register.html"); } else { echo "That is not a valid location!"; } ?> The register page doesn't show up I have tried almost everything I can think of, and it still doesn't work.
View Replies !
Show The Current Time At The Resort On His Home Page.
I have a client who owns a resort in the Philippines. This client wants to show the current time at the resort on his home page. How would this be done with PHP? Is it some calculation based upon GMT? I think (I'll have to check) that the Philippines is +8 GMT...so is that what you'd have to do: create a snippet that grabs the current GMT and add "8" to it?
View Replies !
Showing Database Records As Links To A Page To Show Relevant Detail
What I currently have is list of players what I want to do is make each player a hyperlink to a page with their details on. The hyperlink would be like this www.mydomain.com/playerDetails.php?playerID=1 and it would display the player with playerID 1. I have seen this on lots of sites and would like to know how this is done, can anybody recommend me any tutorials or write me a short script to do this.
View Replies !
Having Different Results On Same Page
I have a database that I would like to use to display the contents in different lists on the same page. In other words, I would like a list of the latest 15 entries in the database to appear in list...then I would like the next 15 to appear on the same page but in a different list structure, etc. I have this so far, but it only displays the latest 15...I am stuck on how to get another list generated from the same query: Code:
View Replies !
10 Results Per Page?
I have many results I want just 20 per page, which I have, but when I click next or any other page number they don't load any other esults. Any ideas why please? If I change $page I see the correct results, so if i change $page=3 then I see the results that I should on page 3. Any ideas how to get it workin with the links? Code:
View Replies !
Use Arrays To Page Through Results?
I've got a search facility that interrogates an SQL database then shows the results 30 at a time. Currently, when you go to the next page of results it has to run the query all over again, because there is no way of handing the resultset to the PHP file. So I wondered if there was another way of doing it. I'm tempted to use mysql_fetch_array and create a multi-dimensional array full of result rows, then hand that around, but so far cannot find out how to hand a PHP array as a variable to a PHP page. IS this possible, or am I barking up the wrong tree? Or is there a better way of doing this?
View Replies !
Multi-page Results....
I'm working on an engine to search a MySQL database of a bunch of forum messages. The PHP code retrieves the results from the database, then stores them into an multi-dimensional array for processing. Once stored, the code parses each result and assigns it a relevancy score, and once all of the results are scored, it then sorts all of the results according to relevance. The end product off all this is an array that holds all of the retrieved messages relevant to the search, holding such information as title, author, date, msgID, blah blah blah. now that i've kinda explained what's going on, i'll get into the problem i've bumped into. Being that there's roughly 16,000 messages in the database (not to mention the 800,000 lines of message text) that could possibly be the results from a query, displaying it all on one page is most definately out of the question (it still takes a few seconds to load on my cable line with only a few hops to the T3'd server. I'd hate to see what a 33.6 or 56k user would be waiting for). The real problem all comes down to: how am I going to pass the results from one page to the next? an array of a few thousand messages is a *little* large for an http post action, and storing the results in a table in the mysql database posses a few problems as well (namely, how long to keep the table around after the user has executed the search. temporary tables are out of the question, as they die as soon as the mysql connection is closed, but a persistent mysql connection would create exactly the opposite problem: ei, temp. tables never die).
View Replies !
|