Beginner Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOtherBeginner Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
  #1  
Old August 11th, 2002, 09:26 AM
graeme graeme is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2002
Location: Manchester England
Posts: 3 graeme User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Navigating records

A couple of points around Navigating
i have entered 70 records into mysql and missed one out, My navigation bar flips throught the records in the order they were entered in as I entered them sequentially this was not a problem now i have realised that i have missed one out. Is there any thing i can do short of deleting and reinserting the records.
I have a column that relates the sequence of records which is not a priamary key, as the records start at 10 but in time will want to start at 1, I had anticipated this as a problem but not yet proficent enought to deal with it

This is a the code for the navigation bar

PHP Code:
<?php if ($pageNum_skmbacis 0) { // Show if not first page ?>
                  <a href="<?php printf("%s?pageNum_skmbacis=%d%s"$currentPage0$queryString_skmbacis); ?>"><img src="First.gif" border=0></a> 
                  <?php // Show if not first page ?>
                  </font></td>
                <td width="31%" align="center"> <font size="1" face="Arial, Helvetica, sans-serif"> 
                  <?php if ($pageNum_skmbacis 0) { // Show if not first page ?>
                  <a href="<?php printf("%s?pageNum_skmbacis=%d%s"$currentPagemax(0$pageNum_skmbacis 1), $queryString_skmbacis); ?>"><img src="Previous.gif" border=0></a> 
                  <?php // Show if not first page ?>
                  </font></td>
                <td width="23%" align="center"> <font size="1" face="Arial, Helvetica, sans-serif"> 
                  <?php if ($pageNum_skmbacis $totalPages_skmbacis) { // Show if not last page ?>
                  <a href="<?php printf("%s?pageNum_skmbacis=%d%s"$currentPagemin($totalPages_skmbacis$pageNum_skmbacis 1), $queryString_skmbacis); ?>"><img src="Next.gif" border=0></a> 
                  <?php // Show if not last page ?>
                  </font></td>
                <td width="23%" align="center"> <font size="1" face="Arial, Helvetica, sans-serif"> 
                  <?php if ($pageNum_skmbacis $totalPages_skmbacis) { // Show if not last page ?>
                  <a href="<?php printf("%s?pageNum_skmbacis=%d%s"$currentPage$totalPages_skmbacis$queryString_skmbacis); ?>"><img src="Last.gif" border=0></a> 
                  <?php // Show if not last page ?>


I have also tried in unscessfully to create a jump menu which would allow you to go direct to a record without scrolling through them.
i would like to the menu to dynamically display the content of a column and display the record the you select. all my attempts just leave the jump menu displaying the current record. i have manage to to generate a menu manually that works using html but this is defeating the point of using php

<select name="menu1" onChange="P7_JumpMenu(this,1)">
<option value="skmiss.php?pageNum_skmbacis=0~" selected>NUMBER</option>
<option value="skmiss.php?pageNum_skmbacis=0~">10</option>
<option value="skmiss.php?pageNum_skmbacis=1~">11</option>
<option value="skmiss.php?pageNum_skmbacis=2~">12</option>
<option value="skmiss.php?pageNum_skmbacis=3~">13</option>
<option value="skmiss.php?pageNum_skmbacis=4~">14</option>
<option value="skmiss.php?pageNum_skmbacis=5~">15</option>
</select>
Can you point me in the right direction

Graeme

Reply With Quote
  #2  
Old August 15th, 2002, 07:12 AM
liljim's Avatar
liljim liljim is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Jul 2001
Location: England
Posts: 954 liljim User rank is Lance Corporal (50 - 100 Reputation Level)liljim User rank is Lance Corporal (50 - 100 Reputation Level)liljim User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 18 h 30 m 49 sec
Reputation Power: 7
I'm not going to go into this code, but you should really rethink the way you're doing things. Is there any reason for you manually entering the page number (if that's what you're doing)? How does your SQL table look (columns, and the way you have things set up)?

How, specifically, are you ordering the entries? Chronologically? Alphabetically? What's the criteria for the order you put the entries into the table?

Please provide more details as to what you're actually doing (or wanting to do).

Reply With Quote
  #3  
Old August 16th, 2002, 03:27 AM
graeme graeme is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2002
Location: Manchester England
Posts: 3 graeme User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I have manages to sort the the records in to the correct order by sorting the files by using column I incorporated to describe the magazine issue no.
I have worked out a more precise question.

I have a template that the back issues of a magazine are displayed in skm.php
how do I define a link to skm.php record (x) defined by column (issue)
I would like to display back issue no 15. column (issue ) contains the no. 15
but the id prime key is no 130 the column (issue) is the only column that corresponds to the back issue.

Ideally I would like to create a jump menu to take people to the exact back issue they want to view

Finally books, I have bought a couple of books on php They introduce php in a very simple way then then immediate jump in to complex situation. I just need to continue looking at more simple scenarios till I grasp the language
Can you recommend any books for a simpleton like me.

Graeme

Reply With Quote
  #4  
Old August 16th, 2002, 04:32 PM
liljim's Avatar
liljim liljim is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Jul 2001
Location: England
Posts: 954 liljim User rank is Lance Corporal (50 - 100 Reputation Level)liljim User rank is Lance Corporal (50 - 100 Reputation Level)liljim User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 18 h 30 m 49 sec
Reputation Power: 7
Graeme, I see what you're trying to do now. You could have been a lot more descriptive in what you were attempting to achieve in the first place, and then we could have come up with suggestions for you.

So, from what I can gather, you're creating a system whereby magazines are put into a table? The best way of ordering this would be to have a date value (stored in MySQL date format), and order by that value. Ordering by issue number is fine too, but IMO, you really could do with a date field so that when you get the hang of mysql a bit more, you can do links to things like "View last year's magazines" and use a query like this to get all of the issues from last year:

PHP Code:
 $lastyear date("Y") - 1;

$get_last = @mysql_query("SELECT [whatever] from magazines WHERE YEAR(datefieldname) = $lastyear ORDER BY datefieldname ASC"); 


As for your current question, you could have a page called "issue.php". On the menu that lists your issues in your skm.php file, you could have a link like issue.php?issue=<?php echo $row['issue']; ?> and your issue page might be something like:

PHP Code:
<?php

 
// Force a type on the integer.
 
$issue = (int)$issue;

 
// check whether an issue with this number is in the database.
 
$query "SELECT * FROM magazines WHERE issue = $issue";

 
// Do the query.
 
$get_mag = @mysql_query($query)
    or die(
"Unable to perform the query. The returned error was: " mysql_error());

 
// If there are no rows, then exit, since there isn't a magazine with 
 // this issue number in the table.
 
if (mysql_num_rows($get_mag) == 0)
 {
    die(
"Invalid id - no issue of the magazine exists in the database with that issue number. It has either been deleted, or it never existed in the first place.");
 }

 
$row mysql_fetch_array($get_mag);

 
// Print out all of the stuff.

?>


I've kept that very simple, you should be able to understand what I mean OK.

If you're after a really simple book, that gets you off to a good start with both PHP and MySQL, try "PHP Fast and Easy Web Development" by Juli C Meloni. I'll warn you - it IS very, very simple, but has a good case study of putting together a database of your CD collection, something that isn't too far from what you seem to be doing here. It was the first PHP book I bought, going back a few years ago now. You would probably read it within a week, and have it all sussed, but it coasts you easily into a range of issues that you can then expand on through the other books you've bought (which were they, by the way), or through tutorials on the net and the manual. Just be sure that you want something as simple as this book before buying it though.... I don't want to be responsible for you screaming, "I past all of this stuff ages ago".

For other book recommendations, do a search through these forums. It's a topic that's been covered umpteen hundred times before

Good luck.

Reply With Quote
Reply

Viewing: Dev Shed ForumsOtherBeginner Programming > Navigating records


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five "checkpoints" for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway