Search the Community
Showing results for tags 'previous'.
-
Hi , i read many articles and tried many things before asking but i came to a dead end. My problem is very simple (or at least i believe so). In the main directory \httpdocs there is this file we call "header.php" and another file we call "article.php". So the code of the article is very simple: <?php include("header.php"); echo "bla bla bla\n"; ?> So far so good. Let's say that we create a new folder \httpdocs\new_folder and inside there we create a new file that we call "new_file.php". So we would simple like to call the header.php from the parent folder BUT IT TURNS TO BE IMPOSSIBLE ! I have tried: include('../header.php'); (in an article of this website says that this work - well IT DOESN'T ! i have tried many other things but i cannot load the header.php from the previous directory ! I wanna tip the person who will find the solution so you better leave a paypal along with the answer !
-
I have the following code allowing me to navigate to the previous or next record in the db. In the code below, I would like to swap 'new_date' (which is in the 000-00-00) format for the existing 'record_id' in the script. I need to navigate via the new_date because it is possible with my program to delete a record and reenter it later for that passed date causing the record_id to be out of sinc with the reord_id. Example: My record_id is auto-increment so if I find a mistake in a past record and go to fix it for that date in the past, my auto-increment would be 235, 236, 237, 568, 239, 240 etc., so I can't use record_id to navigate next and previous. When I use new_date instead of record_id, my error says either that the query was empty, or that Variable id not defined. Script terminating. I would appreciate any help you can give, Thanks! Doug This is also on a web page, so here's my code: php: $current_id = $_GET['record_id']; $record_id = $current_id; $prevquery = "SELECT * FROM daily_sales WHERE record_id < $current_id ORDER BY record_id DESC LIMIT 1"; echo $current_id; $prevresult = mysql_query($prevquery) or die(mysql_error()); while($prevrow = mysql_fetch_array($prevresult)) { $previd = $prevrow['record_id']; } $nextquery = "SELECT * FROM daily_sales WHERE record_id > $current_id ORDER BY record_id ASC LIMIT 1"; $nextresult = mysql_query($nextquery) or die(mysql_error()); while($nextrow = mysql_fetch_array($nextresult)) { $nextid = $nextrow['record_id']; } html: <a href="http://www.mywebsite.com/view.php?record_id=<?php echo $previd; ?>">Previous</a> <a href="http://www.mywebsite.com/view.php?record_id=<?php echo $nextid; ?>">next</a>