Display a subset of records is to limit the information that I can show

Hi all

I develop page TOC of my Gallery of photos and when I started, I had a lot of data, I wanted to show and through the use of lookup tables and appropriate in my SELECT query logic, I could show a vertical list of galleries which corresponded to a specific category. Each has been rated two samples thumbnail, title, description, model, photographer and makeup artist names. I was even able to set the page title and the header to display the appropriate information.

A query SELECT additoinal counted the number of galleries in the main table that relate to the current query string value.

Another query SELECTION counted the number of photos each different gallery photoset and displays this information in the title of EACH Gallery.

The description is in the opposite direction to the flow of the code, keep in mind. Here is the code (the $spec variable is the query string.):

get the total number of photos in a gallery photoset
$conn = dbConnect ('query');
$getTotal = "SELECT COUNT (*).
Pictures, 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 (*).
Galleries
WHERE galleries.g_spec = '$spec % "";
$g_total = $conn-> query ($getGtotal);
$row = $g_total-> fetch_row();
$galTotal = $row [0];

get thumbnails from the gallery name, description, subject, category, model, photographer, mua
$conn = dbConnect ('query');
$sql = "SELECT g_thumb1, g_thumb2, g_name, g_desc, subject_id, stuff, model_name, photographer_name, mua_name.
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 DESC g_id ';
$result = $conn-> Query or die (mysqli_error ());
$galSpec = $result-> fetch_assoc();

end of the code.

In any case, it worked perfectly. However, I've added galleries, this list will get quite long. So, I wanted to add navigation that would break the number of galleries in set amounts.

When I introduced parameters to LIMIT the number of queries poster based on a variable called SHOWMAX, my display got all botched. Certainly, I adapt the code of the book of David Powers PHP Solutions and learn that I will. I gave up on all of the above data display and went the simple route, thinking that I would like to add more features that I learned. This operation necessitated the restructuring a bit of my database.

Here's the code I added which allows a navigation based on the limit of 3 entries per page:


set the maximum number of records per page
define ('SHOWMAX', 3);

get the number of galleries

$conn = dbConnect ('query');
$getGtotal = "SELECT COUNT (*).
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 the subset of galleries
$conn = dbConnect ('query');

calculate the starting line of the subset
$startRow = $curPage * SHOWMAX;

$sql = "SELECT."
Galleries
ORDER BY DESC g_id
LIMIT $startRow,". SHOWMAX;
$result = $conn-> Query or die (mysqli_error ());
$galSpec = $result-> fetch_assoc();

end of the code.

With a code of navigation in the body:

< div id = 'header4' >
< P > displaying <? PHP echo $startRow + 1;
If ($startRow + 1, $galTotal) {}
ECHO "at";
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). "" "" > < /A > back. "
}
If ($startRow + SHOWMAX < $galTotal) {}
echo "< a href ="'. $_SERVER ['PHP_SELF'].'? curPage ='. ($curPage + 1). "" ' > Next < /a > ';
}
? >

Now I can view my information Gallery in a group of 3 per page.

THE PROBEM, it IS that when I add additional queries, for example to get the subject and the category of information, the model, the photograpger and makeup information or artist, he doesn't always show up, sometimes it messes up the display, and in all cases, these additional information disappears when I navigate a subset of a subset. That's why I asked the performance values from one page to another.

I absolutely obstructionisme and I have to put galleries in service without navigation until I can understand it. I'm willing to even hire someone for advice. I can't make this work. Yes, I know it is complicated for someone of my skill level, but I have no choice, I have to do this work.

Alternative forms of navigation/view subsets of records would be greatly appreciated. ANY help, suggestions or advice will be greatly appreciated.

Please read through it all.

Sincerely,.

wordman

Again you are misunderstanding. I'm not suggesting to hardcode values. I just wonder if you are / were trying to pass the object real and descriptions of category or the category id and the subject so that you can refresh the database on every page.

> I do not think that the page re - questions on navigating, I think that it loads just the table info.

I don't think so. Just look at the SQL code. It uses the values of offset and limit which means for me that it returns only the lines of the current page. What picture are you talking about?

> So, I added a separate request to take this info from the database, and it bombards the page.

I really think you tackle this all wrong. Right now you are looking for solutions to specific problems without having a solid foundation in the technologies involved. Trying to build that you learn is a recipe for disaster and frustration. Stop what you are doing for awhile. Work on some php and tutorials SQL which are not related to this project. Work through them, until you understand what makes each line of code.

Currently, you are directed down a rat hole. You can get the most work, but you will be be plagued by bugs and scripts that are difficult to maintain.

Tags: Dreamweaver

Similar Questions

  • Can't remember how to access my setings bcc, so how to cancel the limit on the number that I can answer in what concerns?:

    Received a message that had been directed to a number of recipients and wanted to respond to all:, but who exceeded my limit on the number of addresses for to: and Thunderbird would not accept.

    I went through a process of establishing a way to have e-mail messages to multiple recipients automatically addressed to bcc

    Maybe it's a supplement that you have installed.

    As part of this process, I put a limit on the number of recipients that would be treated as "to:.".

    Is Thunderbird built-in AFAIK. Check your add-ons and all the settings that you can do.

  • I have a new time capsule airport. How to limit the search for who can use the time capsule backup process?

    I have a new time capsule airport. How to limit the search for who can use the time capsule backup process?

    Set a password to disk... disk tab in the utility... and just give to those you want to use the TC...

  • How to limit the number of printers can be installed on this computer by using Group Policy?

    How to limit the number of printers can be installed on this computer by using Group Policy?

    Hello

    Thanks for asking! If I understand correctly, you should limit the printers installed on the computer by using Group Policy. I suggest you follow the troubleshooting steps to check if this may help.

    The question you have posted is related to Technet and would be better suited to the Technet community. Please visit the link below to find a community that will provide the best support.
    http://social.technet.Microsoft.com/forums/en-us/category/WindowsServer

  • Cannot disable the CS6.  Have disabled successfully recently because of computer problems.  Is there a limit to the time that you can disable?

    Cannot disable the CS6.  Have disabled successfully recently because of computer problems.  Is there a limit to the time that you can disable?

    Hello

    I think to delete the content in the files SLCache and SLStore files should work for this.

    Concerning

    Jitendra

  • How can I limit the information displayed with a message?

    When I hilight a screen message includes twenty or more lines of technical information that I don't want and didn't used to be there. How can I get the display to normal email format?

    View (Alt - V) - headers - Normal

  • I'm looking for a sleep mode function that goes off after some time. I would like to limit the time that my teenager spend on the game

    I know how to use window 7 time limit control. BUT it does allow me to leave my teenager spend any time of the day only 2 hours. I'm looking for something like a standby mode. After that he connects to his side of the user of the computer, turning after 2 hours of play.

    (Moved from Gaming)

    Hi Stephanie,

    Thanks for posting your request here in the Microsoft Community.

    We have a feature called schedule a task, this will help you plan the task of putting the computer in Mode standby when you want the computer to access the Mode sleep. See the following Microsoft Help article to learn more about this feature.

    http://Windows.Microsoft.com/en-us/Windows/schedule-task#1TC=Windows-7

    For more information, you can consult the following Microsoft Help article.

    http://Windows.Microsoft.com/en-us/Windows7/sleep-and-hibernation-frequently-asked-questions

    Please reply with the status of the issue so that we can better help you.

  • How to limit the command CTRL + K to show shortcuts

    Hi all


    Somebody help me to ' how to limit * CTRL + K * command to see a list of shortcut? I want to stop this list to display everything.

    And also to customize keyboard shortcuts.


    Arif

    I assume you are using forms on the web.

    If so, you must edit the fmrweb.res file located in the directory $ORACLE_HOME/forms.

    This file will has all the keymappings to function keys and you can customize them in there.
    To stop Ctrl-K work you must comment out the line for the keys Ctrl-K/Show by placing a pound sign (#) at the beginning of the line.
    Further instructions can be found in the file.

    Another tactic to take would be to introduce an OTHER KEY trigger to the level of form that gives a message such as "This key not used here, please..." ", you will then need to explicitly define triggers for all keys to be used, for example a KEY NEXT-ITEM trigger that contains the code"NEXT_ITEM ";

    hope this helps, please mark it as correct if it does.

    Published by: Ady Keeling on June 9, 2010 13:13

  • Select many Listbox - limit the number of items can be selected

    Hello

    I use Jdev 11.1.1.4.0.

    I have a component to select many Listbox in a jspx page. Requirement is that the user can select up to 5 items of the listbox. I have to somehow keep track of the number of selection and ask the user if there is more than selected 5. My plan is to:

    1 bind the component in a backingbean
    2. listen ValueChangeListener and obtain the total number of selected items
    3. If selected is greater than 5, prompt the user.

    Any suggestion, comment or pointer will be greatly appreciated.

    Thank you

    Bones Jones

    See this example for SelectManyListBox when it prompts a message - when the number of records selected is greater than 2.

    Sample.JSPX:



    xmlns:f = "http://java.sun.com/jsf/core".
    xmlns:h = "http://java.sun.com/jsf/html".
    xmlns:af = "http://xmlns.oracle.com/adf/faces/rich" >




    *
    selectAllVisible = "false".
    * Binding = "#{SampleBean.selectManyListBox}" *.
    * inlineStyle = "width: 400px."
    * autoSubmit = "true."
    * valueChangeListener = "#{SampleBean.valueChangeListener}" > *.
    **
    **
    **
    **
    **
    **



    * SampleBean.Java: *.

    import java.util.List;

    Import javax.faces.application.FacesMessage;
    Import javax.faces.context.FacesContext;
    Import javax.faces.event.ValueChangeEvent;

    Import oracle.adf.view.rich.component.rich.input.RichSelectManyListbox;
    Import oracle.adf.view.rich.context.AdfFacesContext;

    public class SampleBean {}
    private RichSelectManyListbox selectManyListBox;

    public SampleBean() {}
    }

    {} public void setSelectManyListBox (RichSelectManyListbox selectManyListBox)
    this.selectManyListBox = selectManyListBox;
    }

    public RichSelectManyListbox getSelectManyListBox() {}
    return selectManyListBox;
    }

    * public Sub valueChangeListener (ValueChangeEvent valueChangeEvent) {*}
    * if (selectManyListBox! = null) {*}
    List = (List) valueChangeEvent.getNewValue () selectedValues; *
    * if (selectedValues! = null & selectedValues.size () > 2) {*}
    * this.selectManyListBox.setValue (valueChangeEvent.getOldValue ()); *
    * AdfFacesContext adfFacesContext = *.
    * AdfFacesContext.getCurrentInstance (); *
    * adfFacesContext.addPartialTarget (this.selectManyListBox); *

    * FacesContext context = FacesContext.getCurrentInstance (); *
    * FacesMessage msg = *.
    * new FacesMessage (FacesMessage.SEVERITY_ERROR, null, *)
    (* ' The number of values selected in the selection list box number cannot be more than 2 "); *
    * Context.AddMessage (null, msg); *

    *}*
    *}*
    }
    }

    Thank you
    Nini

  • How to limit the programs that load at startup?

    How to prevent apps will load at startup?

    One place to check: Apple menu > System Preferences > users and groups > click the user in the left sidebar, then the login at the top items.

  • When I try to send an email, the following message is displayed: "windows Live Hotmail was not able to complete this application. Microsoft may contact you to the subject of the problems that you can declare"

    What information are you looking for?  The question is not clear?  Just ask me what you want in detail and I'm going back willingly.

    Don

    Hi DonSanders,

    When you use Windows live mail and the question you have posted is related to Windows Live, so it would be better suited in the Windows Live community. Please visit the link below to find a community that will provide the best support.

    Windows Live Solution Center Hotmail Portal

    http://windowslivehelp.com/product.aspx?ProductID=1

    I hope this helps.

  • How can I change the name that is displayed for my iCloud account?

    When I connect to my iCloud account or view it in settings on my iPad, my husband name, rather than mine, is displayed next to my e-mail address.  I checked my address book to make sure that my iCloud email address is not listed under his name.  Probably we sometimes a place I use his name in conjunction with my e-mail, because there is no to all computers.  I connected thinking iCloud I would find a way to change the display name on my account and could not thin anything.  Is there a way?  It has not always done.  I noticed only recently.

    You should be able to change the name on your ID by going to https://appleid.apple.com/Apple. Sign in to your ID in the first section (account), click on the "Edit" button, and the name on the account should be included among the information that you can change.

  • Question for David Powers on a subset of records display

    David,

    I used your fantastic book, PHP Solutions to great success in the development of my own projects.

    My problem is in the rest of your approach to display a subset of the records in my database. In your book (page 333, php solution 12-4), you use the tables, and in my design, I am using CSS. Everything works fine if I display the record set, but when I want to limit the number of records displayed on a page, I can't make it work. I suspect that your method using the table is "autonomous" insofar as the table was created on the various parameters of the subset.

    I don't have an example of a line of code, rather I would like to find a resource that could help me shed some light on this problem. I have tried things for hours today, but can't achieve my goal to limit the quantity x of subsets per page.

    Any help in the right direction would be greatly appreciated.

    Sincerely,

    wordman

    The fact that the thumbnails are displayed in a table is not relevant. What controls the subset of records being retrieved from the base is the code in step 4 top of page 335.

    $startRow is the current page number (counted from 0) times SHOWMAX (the number of items to display on the page.

    Which translates the SQL on page 2 that said: ' SELECT * LIMIT 6, 6 IMAGES. ($startRow is 1 * 6).

  • Is there a way to limit the volume and not only for music?

    Hello

    I have a child who loves the max volume. However, it is not only bad for his ears, he pushes the rest of the family crazy.

    As much as I saw him, he has no control master volume where you can limit the volume - that it JUST for music, leaving the rest of us stranded.

    I tried mental health of volume app, but since it's an app, it can be disabled without a password and so my child understood how close. So that one does not work.

    Anyone know of another way to limit the amount of EVERYTHING?

    Hi Makkapakka777,

    I understand that you like to limit the volume on your iPad so that it cannot be increased beyond a certain point. Fortunately Restrictions allows you to set a volume limit that requires an access code to remove. The article below the link provides more information about the configuration and use of the Restrictions.

    Restrictions of use on your iPhone, iPad and iPod touch
    https://support.Apple.com/en-us/HT201304

    Kind regards!

  • How to keep the audit record for access to the Internet folder?

    Referring to the following link, I like to keep the audit record for access to the file from the Internet,

    Does anyone have suggestions on the option that I can put on this record?

    Thanks in advance for your suggestions

    http://support.Microsoft.com/kb/310399

    Hello

    You can follow this link & check if the problem persists:

    Monitor attempts to access and change settings on your computer

    Hope the helps of information.

Maybe you are looking for