Displaying a subset of records is limiting the information I can show

Hello All,
I'm developing my photo gallery's TOC page and when I began, I had lots of data I wanted to display and through the use of lookup tables and the proper logic in my SELECT query, I could show a vertical list of galleries that matched a specific category. With each was listed two sample thumbnails, title, description, model, photographer and make-up artist names. I even was able to set the page title and header to display the proper information.
An additoinal SELECT query counted the number of galleries in the main table that were relevant to the present query string value.
Another SELECT query counted the number of photos in each different gallery photoset and displayed that information in EACH gallery's title.
The description is in reverse to the flow of the code, keep in mind. Here is the code (the $spec variable is that of the query string.):
//get the total number of photos in a gallery photoset
$conn = dbConnect('query');
$getTotal = "SELECT COUNT(*)
            FROM photos, galleries
            WHERE galleries.g_spec = '$spec%'
            AND galleries.g_id = photos.g_id ";
$total = $conn->query($getTotal);
$row = $total->fetch_row();
$totalPix = $row[0];
// get the number of galleries
$conn = dbConnect('query');
$getGtotal = "SELECT COUNT(*)
            FROM galleries
            WHERE galleries.g_spec = '$spec%' ";
$g_total = $conn->query($getGtotal);
$row = $g_total->fetch_row();
$galTotal = $row[0];
//get gallery thumbnails, name, description, subject, category, model, photographer, mua
$conn = dbConnect('query');
$sql = "SELECT g_thumb1, g_thumb2, g_name, g_desc, subject_id, category_id, model_name, photographer_name, mua_name
        FROM galleries, gallery_spec, model_names, photographer_names, mua_names
        WHERE galleries.g_spec = '$spec%'
        AND gallery_spec.g_spec = galleries.g_spec
        AND model_names.model_id = galleries.g_model
        AND photographer_names.photographer_id = galleries.g_photographer
        AND mua_names.mua_id = galleries.g_mua
        ORDER BY g_id DESC ";
$result = $conn->query($sql) or die(mysqli_error());
$galSpec = $result->fetch_assoc();
*** end of code.
Anyhow, this worked wonderfully. However, as I add galleries, this list will get quite long. So, I wanted to add navigation which would break up the number of galleries into set quantities.
When I introduced parameters to LIMIT the number of queries displayed based on a variable called SHOWMAX, my displayed data got all botched. admittedly, I'm adapting code from David Powers' book PHP Solutions and am learning as I go. I gave up on displaying all of the data shown above and went the simple route, figuring I'd add more features as I learned. This necessitated restructuring my database a bit.
Here is the code I added that allows for navigation based on a limit of 3 entries per page:
// set maximum number of records per page
define('SHOWMAX', 3);
// get the number of galleries
$conn = dbConnect('query');
$getGtotal = "SELECT COUNT(*)
            FROM galleries ";
$g_total = $conn->query($getGtotal);
$row = $g_total->fetch_row();
$galTotal = $row[0];
// set the current page
$curPage = isset($_GET['curPage']) ? $_GET['curPage'] : 0;
// retrieve subset of galleries
$conn = dbConnect('query');
// calculate the start row of the subset
$startRow = $curPage * SHOWMAX;
$sql = "SELECT *
        FROM galleries
        ORDER BY g_id DESC
        LIMIT $startRow,".SHOWMAX;
$result = $conn->query($sql) or die(mysqli_error());
$galSpec = $result->fetch_assoc();
*** end of code.
Along with some navigation code in the body:
<div id="header4">
    <p>Displaying <?php echo $startRow+1;
          if ($startRow+1 < $galTotal) {
            echo ' to ';
            if ($startRow+SHOWMAX < $galTotal) {
              echo $startRow+SHOWMAX;
            else {
              echo $galTotal;
          echo " of $galTotal";
          if ($curPage > 0) {
                      echo '<a href="'.$_SERVER['PHP_SELF'].'?curPage='.($curPage-1).'"> Back </a>';
          if ($startRow+SHOWMAX < $galTotal) {
                      echo '<a href="'.$_SERVER['PHP_SELF'].'?curPage='.($curPage+1).'"> Next </a>';
          ?>
I can now display my gallery information in groups of 3 per page.
THE PROBEM IS that when I add additional queries, say to get the subject and category information, model, photograpger and or make-up artist information, it doesn't always come up, sometimes it messes up the display, and in all cases, this additional information disappears when I navigate from subset to subset. This is why I have been asking about carrying values from one page to the next.
I am absolutely stonewalled and am going to have to put the galleries into service sans navigation until I can figure it out. I'm willing to even hire someone for advice. I just can not make this work. Yes, I realize it's complex for someone of my skill level, but I have no choice, I have to make this work.
Alternate forms of navigation/showing subsets of records would be greatly appreciated. ANY help, suggestions or guidance will be greatly appreciated.
Thank you for reading through all this.
Most sincerely,
wordman

Again you are misunderstanding. I'm not suggesting hardcoding any values. I am only asking if you are/were trying to pass the actual subject and category descriptions, or the id's of category and subject so you can requery the database on each page.
> I don't think the page re-queries on navigating, I think it just loads  info from the array.
I don't think so. Just look at the SQL. It's using the limit and offset values which means to me that it's only returning the rows for the current page. What array are you talking about?
>So, I added a separate query to pick this info from the DB, and it bombs  the page.
I really believe you are going about this all wrong. Right now you are searching for solutions to specific problems without having a solid foundation in the technologies involved. Trying to build as you learn is a recipe for disaster and frustration. Stop what you are doing for a while. Work on some php and SQL tutorials that are unrelated to this project. Work through them until you understand what each line of code is doing.
Right now you are headed down a rat hole. You may get most of it to work, but you will be plagued by bugs and scripts that are difficult to maintain.

Similar Messages

  • How do I reinstate the information bar that shows the prevention of opening a pop-up window?

    After Firefox opened the information bar telling me they blocked a pop-up window I inadvertently clicked the option link and deleted the information bar from coming up again.
    How do I reinstate the information bar that shows the prevention of opening a pop-up window?
    == This happened ==
    Just once or twice
    == I clicked the option link and selected the "do not show this again" option

    I set browser.popups.showPopupBlocker to false, and information bar still appears.
    When I also set privacy.popups.showBrowserMessage to false, it doesn't appear.
    To test, whether the information bar appears, I use
    [http://www.popuptest.com/popuptest3.html]
    So, set to true preferences
    privacy.popups.showBrowserMessage
    and
    browser.popups.showPopupBlocker
    Both of them!!!
    Does it help you?

  • The information that can be found in the Document Properties of a PDF, such as the author's name, ke

    The information that can be found in the Document Properties of a PDF, such as the author's name, keywords, and the PDF's page size, is known as which of the following?

    Sounds like a question from a test... Only without the multiple-choice options.

  • Is it possible that the home button can show a light when a message or a phone call has beebn missed?!

    Is it possible that the home button can show a light when a message or a phone call has beebn missed?!

    No.
    There is no light there.

  • Multiple display formats for several records coming from the same table

    Hello all,
    I want to create one Crystal Reports XI report to display several records coming from one table, but I need different display format for different records from that one table.
    There is a field RecordType and based on that value, the record will be displayed differently on the report page.
    Can I have several sections in the report and to define different SQL query in each of them?
    Example of the report I need to see on paper:
    ================================================
    Summary of 216 vehicles:  (the value 216 comes from record with RecordType=1)
    Vehicle Category    Number of Vehicles
              A                   5          (this value 5 comes from record with RecordType=2)
              B                   7          (this value 7 comes from record with RecordType=3)
              D                   4          (this value 4 comes from record with RecordType=4)
    Category A vehicle numbers:
    2345   6789   8765   5543   3452    (these five values come from records with RecordType=5)
    Category B vehicle numbers:
    9876   8876   9987   4321   6754   5215   4543    (these values come from records with RecordType=6)
    Category D vehicle numbers:
    2343   2344    2348   2377    (these values come from records with RecordType=8)
    ==============================================================
    Text is fixed (labels), number values are coming from table records.
    What would be a good way to do this in Crystal Reports XI ? In Cognos ReportNet, I would just create several Queries (SQL sentences) and place their outputs on a page, one after the other.
    I use Crystal Reports XI R2 and Oracle 10g database through and ODBC connection.
    Thank you,
    Milan

    Obaid and Debi,
    Thank you for your replies.
    I can create multiple sections in the report, but I don't know how to split the 20 records that I get back from the database to be displayed in 5 different report sections.
    How can I define different SQL statement for each of 5 report sections?
    How can I use cross-tabs to display what I need? Can I define SQL statement for each cross-tab and then I could place only RecordType=1 records into cross-tab-1 and all RecordType=2 records into cross-tab-2 ?
    In Cognos ReportNet, I defined 2 Queries (SQL statements) and I just placed them in the report one below the other. Query_1 returns 1 record where RecordType value =1. Query_2 returns 5 records where RecordType value =2 and etc. So each record "section" displays record in the way I want it.
    ================================
    Summary of 216 vehicles:  (the value 216 comes from record where RecordType=1)
    Category A vehicle numbers:
    2345   6789   8765   5543   3452    (these values come from records where RecordType=2)
    ================================
    How can I do that in Crystal Reports XI ?
    How can I run several SQL statements from one report?
    Thank you,
    Milan

  • How to limited the Block vendor can't to do the subcontract movement

    we had set the vendor to blocked,
    but we found when the W/H to do the Subcontract action, MB1B , movement 541, the system can't give any warrning message,
    and generate the document no.
    How to setup to restrict the W/H can't to do the movement for this block vendor ?
    Thanks,

    Hi,
    How is the process started?
    If you are using a sub-contract Purchase Order then I believe that the block would occur there, when the PO is created, and the warehouse would have no authority and no paperwork authorising the transfer to the sub-con vendor. If the warehouse is simpley executing a 541 'on the fly' then there doesn't seem much control. Maybe invoicing would be a problem too as there isn't anything to invoice against!
    You may have more luck doing the transfer via MIGO but there is also an OSS note (659005) in this area as MIGO isn't even prompting for the vendor!
    Could be user exit time with one of your ABAPers to check the vendor status when posting a 541 is attempted.
    Regards,

  • Has anyone been able to set up email for other services? I would like to link to a GoDaddy account. Have all the information but can't get it to work.

    I have entered the information from GoDaddy under manual setup and the mail app tells me it cannot connect to the server. It does connect to a gmail account, but that is not helpful. I was wondering if anyone has tried linking to GoDaddy or other account manually and what additional steps it takes.

    Actually, I was able to connect to an IMAP account from (German mail provider) posteo.de without problems. Not so with FastMail.fm, which is a much bigger service provider than posteo.de, and also pretty much IMAP standard compliant.
    Are there different IMAP configurations (all folders on the same level vs. all folders as subfolders of INBOX) that can influence this? And what can be done to connect FastMail to Firefox OS?

  • HT201302 Would there be any need for drivers in Windows 8.1 so that the Iphone 5 can show up on the computer device view?

    Apple Iphone 5 transfer to and from computer on a Windows 8.1 64 bit machine? Do I need to download a driver so that the computer will recognize the device?

    Hi,
    For Visual Basic 6 questions, read the post at the following address
    http://social.msdn.microsoft.com/Forums/en-US/vbgeneral/thread/6a0719fe-14af-47f7-9f51-a8ea2b9c8d6b
    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us.  Thank you for your understanding.
    Kate Li
    TechNet Community Support

  • Displaying a note in an area in the report that can be considered common

    Hi,
    All my KF fields are amounts in INR (Indian Rupees). Is there some way to show that 'all amounts are in INR' in a common place in the report instead of displaying the same in the header of every column
    Edited by: Sanjeev Koganti on Jan 2, 2008 9:51 AM

    Hi Jr,
    Thanks for telling me about the display of scaling factors in the query properties. That reduces work in adding the unit to the description of every KF
    I actually wanted to know if there was way to display 'All amounts are in INR' somewhere in the report since all the KFs are in INR units
    Edited by: Sanjeev Koganti on Jan 2, 2008 10:11 AM

  • Why cann't firefox mobile display PDF script based dropdown menus like the windows version can?

    We use a pdf with active javascripts that allow us to populate field B base on what is entered into field A. This works great in windows based computers running firefox but does not work on our android devices.
    The java script works great on Windows system with Firefox.

    Would you provide a sample or test page of what you are trying to accomplish?

  • What is the information we can get the through details tab in RSMO

    Hi to all,
    Currently I am working for P.support project, All of you well known about the importance of Details tab in rsmo screen. Here we have 4 options from where we can get more informaiton...
    1) Reqest
    2) Extraction
    3) processing
    4) Datapacket information..
    Any one of you pls explain briefly about these options. Any documents regarding these will help me a lot...
    My concern mainly about... How these ooptions are realated to each other...
    Thanks in Advance....
    Rgds,
    Venkat....

    R for Requests says whether the request is working in general ok or not
    E for Extraction says whether data received and scheduled. How many records are sent for extraction and how many are received for extraction.
    T for Transfer IDocs indicates how many data packages are there  for extraction and how many records arrived in each data packages for extraction.
    P for processing indicates transfer rules,update rules and update and processing have any errors or not.
    P for Process Chain will indicate whether it worked ok or not if there is a process chain and load is successful or not.
    Hope this helps please assign points if it does.
    Thanks
    A. Ramasubban

  • I can sync media files from Windows Media Player to my ipod, but the information will not show up on my ipod. Why?

    I HATE using iTunes (it's a pain in the bleeping arse) so, despite what someone from Apple told me, I tried to sync a song from Windows Media Player onto my ipod. The sync appears to be successful, and yet when I ejected my ipod to check to see if the song was on there, it was not. Why? And how do I get it on there? I want to avoid using iTunes at all costs.

    Try MediaMonkey or Winamp. Unlike Windows Media Player which will just blindly throw the files onto the iPod's hard drive these two at least (there may be others) know that they have to update the device's database if you are going to be able to access the content that has been added.
    tt2

  • HT201328 I contacted my carrier and they says: We have provided all the information we can. Please contact Apple for further support. ^JG

    I contacted my carrier which is swisscom of switzerland and they told me only to restore my iphone with a non swisscom card but I didnt get my unlock, now im stuck in the setup as a new iphone, I contacted them again gave them my imei and they responded to me try to contact apple , idk what to do now. Any kind of suggest or help would be great. Thanks, with all respect !

    Gent0502 wrote:
    What could you do to my imei ? Or maybe not you but somebody else
    And yes the iphone has never been jailbroken .
    1). What do expect to accomplish by posting your IMEI here? There is no one from Apple on this forum and Apple does not monitor it. Apple does not unlock phones; the carrier does.
    2). As you have stated that your phone is unlocked as evidenced by the message on iTunes, you can be pretty sure it is, unless as diesel vdub has stated it was hacked/jaibroken in the past or the computer used to sync/unlock the phone was used with another previously hacked/jailbroken phone.
    3). Since we can assume you phone is unlocked, then the problem must be with your SIM. Either:
    a). It is damaged
    b). It has not been activated by the carrier
    c). It is from a carrier that does not support the iPhone.
    On another post, I asked what carrier you are now attempting to use and you have not answered the question.

  • How to create a record based on the name of a file in the file-system?

    Hi,
    With a lot of pictures I want to have a database to gather some information about these pictures.
    First question is how to generate a record based on a file in the file system?
    e.g. the pictures are "c:\fotos\2009\01\disc_001.jpg" to "c:\foto\2009\01\dis_98.jpg" .
    now i want to create records with as one of the attributes the name of the picture (not the picture itself). how to create these records (based on the information of the file-ssytem). i.e. the number of records should be the same as the number of pictures.
    any suggestions?
    any reaction will be appreciated.
    Leo

    Link to Create directory
    http://www.adp-gmbh.ch/ora/sql/create_directory.html
    You can create a list of files in the directory and read the list files from that directory.
    [UTL_FILE Documentation |http://download.oracle.com/docs/cd/B14117_01/appdev.101/b10802/u_file.htm#996728]
    [Solution using Java|http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:439619916584]
    SS

  • Getting the information from a harddrive

    My mother board burned up, so I had to buy a new computer,(tower only), however I havre lots of my business information on my old hard drive, which I did have a friend remoce from my old tower. When I called Staples to ask about buying a box to place the the hard drive in, so that it could be connected to my computer, the person on the phone said I would probably not be able to access the information on said hard drive.  After reading the posts here, it seems to me that I should be able to access the information.  Can I get the information on the harddrive onto a thumb drive?

    You just need an enclosure. I'm guessing it's out of a desktop, and IDE interface. You need this.
    If it's a SATA interface, you need this.

Maybe you are looking for

  • CUPC 8.6.1 and Call Pickup

    Hi, Has anybody tried using Call Pickup from a phone whilst their phone is Desktop Integrated into CUPC 8.6.1202.76? We have noticed that if Phone-A calls Phone-B and Phone-C uses Call Pickup from their Desk phone (796X SCCP in my case) to intercept

  • Error "You cannot enter a partner function for output NEU"

    Hi Experts, I'm having these error "You cannot enter a partner function for output NEU" (message VN041) when I tried to assign a partner function (e.g OA)  in the conditions records for application "EV" (Purchase outline agreement). The system do not

  • Who is online feature ; visibility of what users are in line (Excel login)

    Good morning: We are on BPC 7.5 Netweaver (not Microsoft) and need visibility of what users are on line in BPC (users logged in Excel client). Per SDN that functionality is available in BPC 7.5 for Microsoft under the BPC 7.0 MANAGEMENT CONSOLE  per

  • ICloud won't sync calendar both ways

    I have iCloud syncing my calendars between 6 devices. If I add a new appointment on my Macbook Pro, the appointment shows up everywhere immediately. If I type in a new event on my iPhone, it shows up on all devices, EXCEPT my Macbook Pro. Any ideas a

  • Remove IPX in CATOS

    Hello, Need help with removing IPX config from 6500 runing CATOS, all examples show adding commands but not how to remove. These are the commands I need to remove: set mls agingtime ipx 32   set port protocol 2/1-8 ipx on  set port name     2/8 lab-i