Jump to content

Recommended Posts

Hi,

 

i have created a mysql table for account info which stores basic expenses and income

I have also account.php page that shows the all transactions 10 transaction (row) per page.

there is no problem with that but I like it to show the transactions(entries) per month base. I mean when i open this page i want it to show this month's entries. and when i click previous button i like to see last month's entries.

 

any help will be appreciated.

 

thanks in advance.

 

regards.

 

 

Link to comment
https://forums.phpfreaks.com/topic/219585-display-pages-monthly/
Share on other sites

here is my code for displaying per page and max 10 per page.

I need it to show monthly inmputs, not 10 input(rows) per page.

:)

 

thanks again.

 

// Number of records to show per page:

$display = 10;


// Determine how many pages there are...
if (isset($_GET['p']) && is_numeric($_GET['p'])) { // Already been determined.
$pages = $_GET['p'];
} else { // Need to determine.
	// Count the number of records:
$q = "SELECT COUNT(acc_id) FROM hesap";
$r = @mysqli_query ($dbc, $q);
$row = @mysqli_fetch_array ($r, MYSQLI_NUM);
$records = $row[0];

} // End of p IF.

// Determine where in the database to start returning results...
if (isset($_GET['s']) && is_numeric($_GET['s'])) {
$start = $_GET['s'];
} else {
$start = 0;
}

 

 

// Make the links to other pages, if necessary.
if ($pages > 1) {

echo '<br /><a>';
$current_page = ($start/$display) + 1;

// If it's not the first page, make a Previous button:
if ($current_page != 1) {
	echo '<a href="acc.php?s=' . ($start - $display) . '&p=' . $pages . '&sort=' . $sort . '">Previous</a> ';
}

// Make all the numbered pages:
for ($i = 1; $i <= $pages; $i++) {
	if ($i != $current_page) {
		echo '<a href="acc.php?s=' . (($display * ($i - 1))) . '&p=' . $pages . '&sort=' . $sort . '">' . $i . '</a> ';
	} else {
		echo $i . ' ';
	}
} // End of FOR loop.

// If it's not the last page, make a Next button:
if ($current_page != $pages) {
	echo '<a href="acc.php?s=' . ($start + $display) . '&p=' . $pages . '&sort=' . $sort . '">Next</a>';
}

echo '</a>'; // Close the paragraph.

} // End of links section.

  Truthfully? Here is what i would do...if I were you  ;D

 

a) goto >oscommerce.com

b) SEARCH addons > Reports

c) You will find one, that has ALL THE ROUTINES needed, that will create a "yearly" in which drills down into "Monthly."

"monthly"...

 

d)  You can then copy the code...and modify to your DB and Tables...etc...but take the time to read it...also ;-0...then you'll have the concept.

 

Jim

Hi Dan,

 

thanks for the reply but I must say im newbie, trying to learn it. So, just putting there Month(); will not be clear for me.

I myself tried to do it by creating month arrays but didnt work, tried few other options but couldnt manage it. I am trying. this was the last option for me.Also, im not asking people to do it for me, i need samples to analyse it or explanations to understand it. So, please take it easy. if you dont want to help more than u did, thats ok for me. no need to have a stress. ;)

 

regards.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.