PHP paging between 2 recordsets

Currently I am redoing this page,
Bulk Fuel, that
is originally created using spry and XML and recoding it with PHP
and tying it into a MySQL db. As you can see the user clicks the
city name and the prices change for that city and so does the text,
img,... Well I want to be able to do the same, but using the db.
The products are stored in a table called bFuel using ID as the
key. To determine which product/price pair belong to which city cID
is used (Columbia = 0 or Tri-city = 1).
So how can I get the address, img to change AND the product
list to change as well
Thanks in advance!!

Currently I am redoing this page,
Bulk Fuel, that
is originally created using spry and XML and recoding it with PHP
and tying it into a MySQL db. As you can see the user clicks the
city name and the prices change for that city and so does the text,
img,... Well I want to be able to do the same, but using the db.
The products are stored in a table called bFuel using ID as the
key. To determine which product/price pair belong to which city cID
is used (Columbia = 0 or Tri-city = 1).
So how can I get the address, img to change AND the product
list to change as well
Thanks in advance!!

Similar Messages

  • (PHP/MySql) Create Recordset but no column

    Thanks for reading this, I am new to PHP/MySql
    I have created a website www.ritchiecraft.co.uk which uses
    PHP/MySql with Dreamweaver 8. I have created recordsets on most
    items pages and filtered data as neccessary. After the site was up
    and running I was required to insert a new topic and when I went to
    create a new page and insert the recordset no data was placed in
    the columns area and the filter/sort options were greyed out. I
    checked the existing pages and found that this was happening to all
    pages with recordsets. The connection, table data was there.
    The site still works fine but I cannot introduce new pages or
    edit existing because of the recordset problem. I was advised
    previously to delete the Dreamweaver cache file but this did not
    help.
    The site is hosted commercially and the database was created
    with phpMyAdmin and dont seem to have any connection problems.
    Thanks for your time and any suggestions are welcome.

    sweetman wrote:
    > How can I set a query so that it sounds like this:
    >
    > SELECT $_GET['id'] FROM mytable ORDER BY myorder ASC?
    You can't do it through the Recordset dialog box. The simple
    way to do
    it is to create this query in the Recordset dialog box:
    SELECT * FROM myTable
    ORDER BY myOrder ASC
    Then go into Code view and locate the following line:
    $query_recordsetName = "SELECT * FROM myTable ORDER BY
    myOrder ASC";
    Change it to this:
    if (isset($_GET['id'])) {
    $col = get_magic_quotes_gpc() ? stripslashes($_GET['id']) :
    $_GET['id'];
    $col = mysql_real_escape_string($_GET['id']);
    else {
    $col = '*';
    $query_recordsetName = "SELECT $col FROM myTable ORDER BY
    myOrder ASC";
    David Powers, Adobe Community Expert
    Author, "The Essential Guide to Dreamweaver CS3" (friends of
    ED)
    Author, "PHP Solutions" (friends of ED)
    http://foundationphp.com/

  • Using LIMIT function in PHP/MySQL Dreamweaver RecordSet

    I want to have a record set that skips the first record, and shows the next three. I've found several suggestions online to use the LIMIT function, but I keep getting "error in SQL syntax." What am I missing?
    mysql_select_db($database_adventcms, $adventcms);
    $query_rsSideNews = "SELECT * FROM tb_news LIMIT 1, 3 WHERE status = 'Live' ORDER BY `date` DESC";
    $rsSideNews = mysql_query($query_rsSideNews, $adventcms) or die(mysql_error());
    $row_rsSideNews = mysql_fetch_assoc($rsSideNews);
    $totalRows_rsSideNews = mysql_num_rows($rsSideNews);

    And there we go. That's the reason I need to go through PHP/MySQL training rather than relying on google searches!

  • AC_FL_RunContent and php variable from recordset

    Hi, can anybody point me to a resource on how to grab the
    name of the .swf file from my db and pass it to the active content
    javascript?
    If I just replace the the movie name with a php echo that
    grabs the file name from the db there is no playback.
    TIA
    -Frank

    Should work fine.
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    ==================
    "ronin701" <[email protected]> wrote in
    message
    news:gb9gll$lck$[email protected]..
    > I'll have to strip the extension after I pull it out of
    the record set,
    > assign
    > that value to a variable and echo that in the js where
    there is no
    > extension
    > and use the standard echo in the areas where it need the
    extension, very
    > good,
    > thanks for pointing me in the right direction.
    >
    > -Frank
    >
    http://www.roninwerks.com
    >

  • Show region if field in recordset is NOT empty

    Hi
    Ive been using dreamweaver's built in "show region if
    recordset is not empty," but now i need to change the code so that
    it "shows the region if a field in the recordset is empty"
    Does anyone know how to do this ?
    below is my code for "show region if recordset is not empty"
    recordset: rsUser
    field to filter:image
    <div id="avatar">
    <?php if ($totalRows_rsUser > 0) { // Show if
    recordset not empty ?>
    <img src="uploadedImages/userImages/<?php echo
    $rsUser->Fields('image'); ?>" height="92" width="92">
    <?php } // Show if recordset not empty ?></div>
    basically if the field "image" from rsUser is empty i dont
    want the image to show.
    thanks

    Use the Show If recordset Is Empty server behavior.
    <?php if ($totalRows_rsUser == 0) { // Show if recordset
    empty ?>
    <p>Empty</p>
    <?php } // Show if recordset empty ?>
    Ken Ford
    Adobe Community Expert
    Fordwebs, LLC
    http://www.fordwebs.com
    "Kamesh192" <[email protected]> wrote in
    message news:epkqn2$gr2$[email protected]..
    > Hi
    >
    > Ive been using dreamweaver's built in "show region if
    recordset is not empty,"
    > but now i need to change the code so that it "shows the
    region if a field in
    > the recordset is empty"
    >
    > Does anyone know how to do this ?
    >
    > below is my code for "show region if recordset is not
    empty"
    >
    > recordset: rsUser
    > field to filter:image
    >
    > <div id="avatar">
    > <?php if ($totalRows_rsUser > 0) { // Show if
    recordset not empty ?>
    > <img src="uploadedImages/userImages/<?php echo
    $rsUser->Fields('image');
    > ?>" height="92" width="92">
    > <?php } // Show if recordset not empty
    ?></div>
    >
    > basically if the field "image" from rsUser is empty i
    dont want the image to
    > show.
    >
    > thanks
    >
    >

  • PHP, MySQL, Breadcrumbs and URL Parameters

    I'm working with several InterAKT extensions to buid a
    dynamic site. I have everything working except for Breadcrumbs --
    which are actually working except that I need to change the URL
    parameter which they are passing WITHOUT altering the recordset
    (which breaks the functionality).
    The site is constructed to include friendly URLS, so although
    all pages are loaded by PK of their category, I've used CONCAT()
    and REPLACE() along with Server-Side Includes from my Table (SSI
    from InterAKT) to generate my URLS.
    Example:
    category_ctg TABLE
    id_ctg name_ctg
    1 Jelly Beans
    2 Vanilla Nut Crunch Bar
    etc.
    For my dynamic menus and my hyperlinks, I pull from the db
    like this:
    SELECT *, CONCAT(REPLACE(name_ctg, ' ', '-'), '?id_ctg=',
    id_ctg) AS newurl FROM category_ctg
    This gives me a URL of
    index.php/Vanilla-Nut-Crunch-Bar?id_ctg=2
    (I also pull from the name_ctg field for my page titles and menu
    names, etc., without the CONCAT() so they read without the '-')
    But, with MX Breadcrumbs I'm limited to the way the php is
    hard-coded in terms of which fields are included: (id_ctg,
    id_parent_ctg and name_ctg) because the breadcrumbs are generated
    from a recordset.inc.php file.
    I can succesfully use the Breadcrumbs "out-of-the-box" and
    end up with this URL:
    index.php?id_ctg=2
    My code for above looks like this:
    <?php if ($totalRows_Breadcrumbs > 0) { // Show if
    recordset not empty ?>
    &gt; <a href="index.php?id_ctg=<?php echo
    $row_Breadcrumbs['id_ctg']; ?>"><?php echo
    $row_Breadcrumbs['name_ctg']; ?></a>
    <?php } // Show if recordset not empty ?>
    and while it works, it's loading a different URL than all my
    other menus and links.
    Alternatively, I can include the catgeory_ctg.name_ctg
    dynamic binding like this:
    <?php do { ?>
    <?php if ($totalRows_Breadcrumbs > 0) { // Show if
    recordset not empty ?>
    &gt; <a href="<?php echo
    $row_Breadcrumbs['name_ctg']; ?>?id_ctg=<?php echo
    $row_Breadcrumbs['id_ctg']; ?>"><?php echo
    $row_Breadcrumbs['name_ctg']; ?></a>
    <?php } // Show if recordset not empty ?>
    <?php } while ($row_Breadcrumbs =
    mysql_fetch_assoc($Breadcrumbs)); ?>
    which gives me a URL of:
    index.php/Vanilla%20Nut%20Crunch%20Bar?id_ctg=9
    Since I can't use CONCAT() value within my script and I can't
    have "%20" in my URLs, I'm trying to find a way of turning my URL
    into:
    index.php/Vanilla-Nut-Crunch-Bar?id_ctg=2
    Is there a way to include the CONCAT() function in the PHP
    script that's generating the URL?
    I've tried using variables in the header to call for a
    consistent URL, without any luck.
    Please keep in mind that my strong suit is design and that my
    working knowledge of PHP and MySQL are limited to what I can
    understand and re-create. I've been pulling out my hair for days on
    this, so some guidance would be
    greatly appreciated.

    The code generated by the Dreamweaver recordset navigation bar automatically adds any existing variables to the end of the query string. The following code (just above the DOCTYPE) comes from a recordset navigation bar on one of my pages:
    $queryString_listAuthors = "";
    if (!empty($_SERVER['QUERY_STRING'])) {
      $params = explode("&", $_SERVER['QUERY_STRING']);
      $newParams = array();
      foreach ($params as $param) {
        if (stristr($param, "pageNum_listAuthors") == false &&
            stristr($param, "totalRows_listAuthors") == false) {
          array_push($newParams, $param);
      if (count($newParams) != 0) {
        $queryString_listAuthors = "&" . htmlentities(implode("&", $newParams));
    $queryString_listAuthors = sprintf("&totalRows_listAuthors=%d%s", $totalRows_listAuthors, $queryString_listAuthors);
    I haven't tested this, but to eliminate the extra variables in the query string, comment out the whole of the if statement like this:
    $queryString_listAuthors = "";
    if (!empty($_SERVER['QUERY_STRING'])) {
      $params = explode("&", $_SERVER['QUERY_STRING']);
      $newParams = array();
      foreach ($params as $param) {
        if (stristr($param, "pageNum_listAuthors") == false &&
            stristr($param, "totalRows_listAuthors") == false) {
          array_push($newParams, $param);
      if (count($newParams) != 0) {
        $queryString_listAuthors = "&" . htmlentities(implode("&", $newParams));
    $queryString_listAuthors = sprintf("&totalRows_listAuthors=%d%s", $totalRows_listAuthors, $queryString_listAuthors);
    You will need to do that for each of your recordset navigation bars.

  • Nested XML from recordset problems.

    Hi
    I have been struggling with this for a while now and desperatley need som help!
    I'm trying to create a nested spryregion that looks like this:'
    http://www.soulkompetens.se/utbildningar.php#
    Problem with that page is that it only works in Safari (mac). Firefox the encoding does not work (questionmarks instead of åäö).
    Windows explorer does not work at all .
    So I started to work wit the http://labs.adobe.com/technologies/spry/samples/utils/query2xml.html page to try to generate the xml.
    The XML should be something like:
    <DOCUMENT>
      <ROW0>
        <UTBILDNING_ID>22</UTBILDNING_ID>
        <RUBRIK>Värdegrunden som bas för affärsutveckling</RUBRIK>
        <ROW1>
          <INGRESS>Värdegrunden som bas för affärsutveckling, diskrimineringsgrunderna</INGRESS>
          <ID>17</ID>
         <TEXT></TEXT>
          <DATUM>0000-00-00</DATUM>
        </ROW1>
        <ROW1>
          <INGRESS>Västra Götaland 3:e september</INGRESS>
          <ID>34</ID>
          <TEXT></TEXT>
          <DATUM>2009-06-21</DATUM>
        </ROW1>
      </ROW0>
      <ROW0>
        <UTBILDNING_ID>25</UTBILDNING_ID>
        <RUBRIK>Omvärldsanalys</RUBRIK>
        <ROW1>
          <INGRESS>Mellersta Norrland 11:e december</INGRESS>
          <ID>35</ID>
          <TEXT></TEXT>
          <DATUM>0000-00-00</DATUM>
        </ROW1>
    </ROW0>
    </DOCUMENT>
    I get the XML from two joined Tables in the database.
    Sql looks like:
    select utbildning_rubrik.utbildning_id, utbildning_rubrik.rubrik, utbildning.ingress, utbildning.ID, utbildning.text, utbildning.datum
    from utbildning_rubrik, utbildning where utbildning_rubrik.utbildning_id = utbildning.utbildning_id
    order by utbildning_rubrik.utbildning_id, utbildning.ingress
    Now! How do I generate the XML with "query to xml".
    I have been trying a lot of things an my head is spinning around
    Can anybody help me please.
    Regards
    Olle

    Thank you for the answer.
    I think I am close. But there is something wrong wit the nesting of the nodes and repeating.
    Here is the code:
    <?php
    mysql_select_db($database_SOUL, $SOUL);
    $query_rsImages = "SELECT utbildning_rubrik.utbildning_id, utbildning_rubrik.rubrik, utbildning.ingress, utbildning.ID, utbildning.text, utbildning.datum FROM utbildning_rubrik, utbildning WHERE utbildning_rubrik.utbildning_id = utbildning.utbildning_id ORDER BY utbildning_rubrik.utbildning_id, utbildning.ingress";
    $rsImages = mysql_query($query_rsImages, $SOUL) or die(mysql_error());
    $row_rsImages = mysql_fetch_assoc($rsImages);
    $totalRows_rsImages = mysql_num_rows($rsImages);
    // Send the headers
    header('Content-type: text/xml');
    header('Pragma: public');       
    header('Cache-control: private');
    <?php echo('<?xml version="1.0" encoding="ISO-8859-1"?>'); ?>
    <DOCUMENT>
      <?php if ($totalRows_rsImages > 0) { // Show if recordset not empty ?>
        <ROW0>
        <UTBILDNING_ID><?php echo $row_rsImages['utbildning_id']; ?></UTBILDNING_ID>
        <?php do { ?><RUBRIK><?php echo $row_rsImages['rubrik']; ?>
      <ROW1>
            <?php do { ?><INGRESS><?php echo $row_rsImages['ingress']; ?></INGRESS>
            <TEXT><![CDATA[<?php echo $row_rsImages['text']; ?>]]></TEXT><?php } while ($row_rsImages = mysql_fetch_assoc($rsImages)); ?>
            </ROW1>
            </RUBRIK><?php } while ($row_rsImages = mysql_fetch_assoc($rsImages)); ?>
            </ROW0>
       <?php } // Show if recordset not empty ?>
    </DOCUMENT>
    In the other php document consuming the xml I have
    ds1.setColumnType("RUBRIK", "html");
    So the main problem with this is I dont know php so good that I can repeat the nodes to my choise.
    I neew it to be
    ROW0>
      <UTBILDNING_ID></UTBILDNING_ID>
      <RUBRIK></RUBRIK>
      <ROW1>
        <INGRESS></INGRESS>
        <TEXT></TEXT>
        <DATUM>/DATUM>
      </ROW1>
      <ROW1>
        <INGRESS></INGRESS>
        <TEXT></TEXT>
        <DATUM></DATUM>
      </ROW1>
    </ROW0>
    <ROW0>
      <UTBILDNING_ID></UTBILDNING_ID>
      <RUBRIK></RUBRIK>
      <ROW1>
        <INGRESS></INGRESS>
       <ID></ID>
        <TEXT></TEXT>
        <DATUM></DATUM>
      </ROW1>
      </ROW1>
    </ROW0>
    Can you help?
    Regards
    Olle

  • Autosuggest loadFromServer in PHP

    Hi everybody,
    i'm working on a database with right now 2500 records and
    it's growing, i have to use the autosuggest and it works.
    I adapted the adobe example to do this but it takes about 10
    seconds to load the database at page load and this everytime it
    loads it wich should be often...
    i try to adapt the load from server behaviour but no luck to
    work with my php requests...
    i give you that:
    <div id="productMenuContains"
    spry:region="dsProducts5">
    <div spry:repeat="dsProducts5"
    spry:suggest="{name}">{name}</div>
    </div>
    </form>
    </div>
    <script type="text/javascript">
    var as5 = new
    Spry.Widget.AutoSuggest("productSampleContains",
    "productMenuContains", "dsProducts5", 'name', {loadFromServer:
    true, urlParam: 'prd'});
    </script>
    AND my xml php request
    <?php require_once('../Connections/advert.php'); ?>
    <?php
    if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType,
    $theDefinedValue = "", $theNotDefinedValue = "")
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue)
    : $theValue;
    $theValue = function_exists("mysql_real_escape_string") ?
    mysql_real_escape_string($theValue) :
    mysql_escape_string($theValue);
    switch ($theType) {
    case "text":
    $theValue = ($theValue != "") ? "'" . $theValue . "'" :
    "NULL";
    break;
    case "long":
    case "int":
    $theValue = ($theValue != "") ? intval($theValue) : "NULL";
    break;
    case "double":
    $theValue = ($theValue != "") ? "'" . doubleval($theValue) .
    "'" : "NULL";
    break;
    case "date":
    $theValue = ($theValue != "") ? "'" . $theValue . "'" :
    "NULL";
    break;
    case "defined":
    $theValue = ($theValue != "") ? $theDefinedValue :
    $theNotDefinedValue;
    break;
    return $theValue;
    $hostname_conn = "localhost";
    $database_conn = "pubs_gm";
    $username_conn = "root";
    $password_conn = "";
    $conn = mysql_pconnect($hostname_conn, $username_conn,
    $password_conn) or trigger_error(mysql_error(),E_USER_ERROR);
    ?>
    <?php
    // Query the database and get all the records from the Images
    table
    mysql_select_db($database_advert, $advert);
    $query_rsImages = "SELECT
    `nom_image`,`ID_image`,`fichier_image`FROM tbl_images ";
    $rsImages = mysql_query($query_rsImages, $advert) or
    die(mysql_error());
    $row_rsImages = mysql_fetch_assoc($rsImages);
    $totalRows_rsImages = mysql_num_rows($rsImages);
    // Send the headers
    header('Content-type: text/xml');
    header('Pragma: public');
    header('Cache-control: private');
    header('Expires: -1');
    ?>
    <?php echo('<?xml version="1.0"
    encoding="iso-8859-1"?>'); ?>
    <products>
    <?php if ($totalRows_rsImages > 0) { // Show if
    recordset not empty ?>
    <?php do { ?>
    <product>
    <category><?php echo $row_rsImages['ID_image'];
    ?></category>
    <name><?php echo $row_rsImages['nom_image'];
    ?></name>
    <boximage><?php echo
    $row_rsImages['fichier_image']; ?></boximage>
    </product>
    <?php } while ($row_rsImages =
    mysql_fetch_assoc($rsImages)); ?>
    <?php } // Show if recordset not empty ?>
    </products>
    <?php
    mysql_free_result($rsImages);
    ?>
    AND the xml structure
    <?xml version="1.0" encoding="iso-8859-1" ?>
    - <products>
    - <product>
    <category>148</category>
    <name>Asperges blanches</name>
    <boximage>asperges_blanches.jpg</boximage>
    </product>
    - <product>
    <category>144</category>
    <name>Feuilletine Aoste</name>
    <boximage>aoste_feuilletine.jpg</boximage>
    </product>
    - <product>
    <category>145</category>
    <name>Variétés Aoste</name>
    <boximage>aoste_varietes.jpg</boximage>
    </product>
    - <product>
    <category>146</category>
    <name>Apéricubes</name>
    <boximage>apericubes.jpg</boximage>
    </product>
    i can't adapt my request to seek for the url parameter using
    the online example
    could someone explain me what i should do?
    i don't show you what i already have done but i assure you i
    tried for a few hours without success :(
    thanks a lot
    AND the xml
    structure

    I'm not very clear about the problem you try to describe here
    but I will try to explain what I understood. Please correct me if I
    am wrong.
    You have this script that extracts all the records from a
    database table and export them into an XML. You want to send
    through an URL parameter "prd" the text entered in the autosuggest
    field and the XML answer will contain just the records that
    contains this text in the image name.
    The only change I think you'll have to make in this situation
    is to transform this line:
    $query_rsImages = "SELECT
    `nom_image`,`ID_image`,`fichier_image`FROM tbl_images ";
    into
    $query_rsImages = "SELECT
    `nom_image`,`ID_image`,`fichier_image`FROM tbl_images WHERE
    nom_image LIKE
    '%".empty($_GET['prd'])?"not_a_real_image":GetSQLValueString($_GET['prd'],
    'text')."%'";
    I didn't had the chance to test this code but basically this
    is how it should be done.
    Cristian

  • Lost recordsets

    The problem:
    When I open some old .php pages, the recordsets appear in the
    bindings tab for some pages, but on many they don't. I'm not
    getting any error messages, just a blank window in the bindings
    tab. In all these pages, I can see the MySQL query in the code.
    I've been staring at the code (my favorite pastime) trying to
    determine why some appear and some don't. It would be really
    difficult to recreate all the recordsets and variables.
    Details:
    I'm setting up a new computer. For the most part I've
    successfully duplicated the old setup. I have a lot of dynamic
    pages that were created on the old computer, and are working on my
    live site.
    I've moved the mysql data and connected to the database
    locally, I can create new .php and recordsets from the new duped
    database.
    I've synched the local .php files and the database to the
    working remote site.
    I'm using DW8, XAMPP 2.5 PHP/MySQL, same as the old except
    for perhaps some version updates.

    Hope your end gets better soon! 8)
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    ==================
    "aRT" <[email protected]> wrote in message
    news:gr0krm$3c0$[email protected]..
    > Victory...
    >
    > "I" figured it out. I was so lost in getting the
    recordsets to work, I
    > never got around to installing my WebAssist Ecart
    Extensions. It wasn't
    > until I started going through the page, line by line,
    that I saw that the
    > Ecart was not loaded. I installed it and bam, it
    worked...
    >
    > After all the symptoms, it had to be something on my end
    >
    > So, thanks, all, for pushing me in the right direction.
    >
    >
    >
    > aRT wrote:
    >> I lost my recordsets when I imported them over from
    XP CS3 to Vista-64
    >> CS4.
    >>
    >> Dreamweaver connects to the database when I click
    test and I can create
    >> new Recordsets and view the sample data that it
    connects to.
    >> Anyways, none of my Recordsets get transfered over
    when I export from one
    >> to the other. The recordset can be seen in the code
    but it's not
    >> appearing in the bindings window.
    >>
    >> Anyone have any solutions or an explanation why this
    happens?
    >>
    >> I really don't look forward to the hours it would
    take to recreate all
    >> those recordsets on all my pages so I'm looking for
    a solution.
    >>
    >> Is this something I could submit a ticket to Adobe
    for?
    >>
    >>
    >> Thanks
    >>
    >> Repost; I think my messages were getting too far up
    on the NNTP list. I
    >> think the new title might help
    >>

  • Spry dataset paging

    Is there a way to hide the previous and next buttons when
    there is only one page. I have searched and cannot find how to do
    this. My interface is confusing now because the next and previous
    buttons show all the time... this leads the end user to think there
    is more than one page.

    Thank you for following up. Hopefully, I am close. I never
    would have thought of that. It still doesn't work, but I may just
    misunderstand you.
    Is this what you meant?
    <div spry:if=' "{ds_PageCount}" &gt; "0" '
    align="center">
    When I put quotes around the values the error is gone, but it
    does not evaluate the expression properly. The statement is always
    true, regardless of the number of pages.
    Note:
    It is interesting that if I use the same expression within
    the main recordset's region I get no error. In other words, paging
    requires two recordsets and the main recordset has no error.
    e.g. var pvSubProducts = new
    Spry.Data.PagedView(dsSubProducts, { pageSize: 15 });
    However, if I use expression within the region of the paging
    API recordset I get the syntax error. The recordset used for
    paging, though, is needed as far as I can tell. In all the spry
    examples I read there are two records sets for paging. Here is an
    example of the recordset whos region returns the error.
    e.g. var pvSubProductsPagedInfo =
    pvSubProducts.getPagingInfo();
    And here is my expression:
    <span spry:region="pvSubProductsPagedInfo">
    <div spry:if="{ds_PageCount} > 0">
    ... paging here
    </div>
    </span>

  • Export Advanced Recordset from Database into XML

    I don't think I was clear on my previous post about my goal
    with Exporting an advanced MySQL query to an XML file.
    Simple example: I have a photo gallery that has pictures of
    various Architect Projects. The main page shows distinct images of
    various projects (like an index). When one clicks on this image to
    view the rest of the Project details, a detail page opens with more
    information and additional images within this project.
    I want to use Spry/Ajax to give the images nice dynamic
    effects on the detail page. Normally to get from an index page to a
    detail page using normal server-side procedures, one would have to
    set up a dynamic link to the detail page by passing the recordID
    thru a URL Parameter. The detail page would have a recordset query
    that would call the URL Parameter so that the distinct record
    chosen will be the only record displayed.
    When exporting this query from the database to XML, for some
    reason the following query only displays the <row> node in
    the schema when creating a Dataset. See the following sql query
    that I am trying to use on the detail page to create the dataset
    via XML:
    SELECT*
    FROM project_tbl
    WHERE projectID = [URL PARAM] projectID
    Why, when creating a dataset in Spry and exporting it into
    XML, will this query NOT work?
    What can I do to make this work? URGENT HELP will be kindly
    appreciated.

    Danilo,
    I do not have a link yet as the files are on my remote
    server. I have implemented the code you sent me but still no luck.
    Please see the code I have below:
    The XML Generating Page:
    <?php require_once('../Connections/plymouth.php'); ?>
    <?php
    if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType,
    $theDefinedValue = "", $theNotDefinedValue = "")
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue)
    : $theValue;
    $theValue = function_exists("mysql_real_escape_string") ?
    mysql_real_escape_string($theValue) :
    mysql_escape_string($theValue);
    switch ($theType) {
    case "text":
    $theValue = ($theValue != "") ? "'" . $theValue . "'" :
    "NULL";
    break;
    case "long":
    case "int":
    $theValue = ($theValue != "") ? intval($theValue) : "NULL";
    break;
    case "double":
    $theValue = ($theValue != "") ? "'" . doubleval($theValue) .
    "'" : "NULL";
    break;
    case "date":
    $theValue = ($theValue != "") ? "'" . $theValue . "'" :
    "NULL";
    break;
    case "defined":
    $theValue = ($theValue != "") ? $theDefinedValue :
    $theNotDefinedValue;
    break;
    return $theValue;
    ?>
    <?php
    // Query the database and get the selected records from
    Project & Images
    $colname_rsProject = "-1";
    if (isset($_GET['projectID'])) {
    $colname_rsProject = (get_magic_quotes_gpc()) ?
    $_GET['projectID'] : addslashes($_GET['projectID']);
    mysql_select_db($database_plymouth, $plymouth);
    $query_rsProject = sprintf("SELECT * FROM projects_tbl WHERE
    projectID = %s", GetSQLValueString($colname_rsProject, "int"));
    $rsProject = mysql_query($query_rsProject, $plymouth) or
    die(mysql_error());
    $row_rsProject = mysql_fetch_assoc($rsProject);
    $totalRows_rsProject = mysql_num_rows($rsProject);
    // Send the headers
    header('Content-type: text/xml');
    header('Pragma: public');
    header('Cache-control: private');
    header('Expires: -1');
    ?>
    <?php echo('<?xml version="1.0"
    encoding="utf-8"?>'); ?>
    <root>
    <?php if ($totalRows_rsProject > 0) { // Show if
    recordset not empty ?>
    <?php do { ?>
    <row>
    <?php foreach ($row_rsProject as $column=>$value) {
    ?>
    <<?php echo $column; ?>><?php echo
    $row_rsProject[$column]; ?></<?php echo $column; ?>>
    <?php } ?>
    </row>
    <?php } while ($row_rsProject =
    mysql_fetch_assoc($rsProject)); ?>
    <?php } // Show if recordset not empty ?>
    </root>
    <?php
    mysql_free_result($rsProject);
    ?>
    --------------------------------------------here is the
    source code to the projecct_detail page to display the
    content--------
    The projectID from the category page is being passed via a
    URL parameter. When I pull up the Spry Dataset in this page to
    display the nodes, this is the error I received (Unable to locate
    or parse the XML source (-1,-1). No nodes are being displayed.
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
    Transitional//EN" "
    http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="
    http://www.w3.org/1999/xhtml"><!--
    InstanceBegin template="/Templates/temp.dwt.php"
    codeOutsideHTMLIsLocked="false" -->
    <head>
    <meta http-equiv="Content-Type" content="text/html;
    charset=utf-8" />
    <!-- InstanceBeginEditable name="doctitle" -->
    <title>Untitled Document</title>
    <!-- InstanceEndEditable -->
    <link href="global.css" rel="stylesheet" type="text/css"
    />
    <!-- InstanceBeginEditable name="head" -->
    <script src="SpryAssets/xpath.js"
    type="text/javascript"></script>
    <script src="SpryAssets/SpryData.js"
    type="text/javascript"></script>
    <script type="text/javascript">
    <!--
    var ds1 = new
    Spry.Data.XMLDataSet("xml/detail.php><?php echo(
    isset($_GET['projectID'])?$_GET['projectID']:'' ); ?>", "row");
    //-->
    </script>
    <!-- InstanceEndEditable -->
    </head>
    <body class="oneColFixCtr">
    <div id="container"><!-- InstanceBeginEditable
    name="Main Content" -->
    <div id="mainContent">
    <h1> </h1>
    <p> </p>
    <!-- end #mainContent -->
    </div>
    <!-- InstanceEndEditable -->
    <div id="footer">
    <img src="images/banner.gif" width="500" height="66"
    alt="Plymouth Road Architects" />
    <br />
    <div id="nav">
    <table width="500" border="0" cellspacing="2"
    cellpadding="2">
    <tr>
    <td><div align="center"><a href="
    http://plymouthroadarchitects.com">HOME</a></div></td>
    <td><div align="center"><img
    src="images/bullet.gif" width="8" height="8"
    /></div></td>
    <td><div align="center"><a
    href="company_info.php">ABOUT/CONTACT
    US</a></div></td>
    <td><div align="center"><img
    src="images/bullet.gif" alt="" width="8" height="8"
    /></div></td>
    <td><div align="center"><a
    href="new_homes.php">NEW HOMES</a></div></td>
    <td><div align="center"><img
    src="images/bullet.gif" alt="" width="8" height="8"
    /></div></td>
    <td><div align="center"><a
    href="additions.php">ADDITIONS</a></div></td>
    <td><div align="center"><img
    src="images/bullet.gif" alt="" width="8" height="8"
    /></div></td>
    <td><div align="center"><a
    href="main_street.php">MAIN
    STREET</a></div></td>
    </tr>
    </table>
    </div>
    </div>
    <!-- end #container --></div>
    </body>
    <!-- InstanceEnd --></html>
    Sorry for all the confusion and not submitting this code to
    you earlier on this forum. I really do appreciate your feedback and
    assistance

  • Submitting a Form in a Spry Tabbed Region

    I have a spry tabbed region with 6 tabs.
    I have constructed a menu which targets and opens the specific tab using the ?tab=4 type notation.  I have also created links between tabs using the same notation.  All works fine.
    I have a form in one tab which, when I submit it, I want to return to the same tab.  However when I use the notation <form action="index.php?tab=4" > the page just reloads on the first tab, stripping off the ?tab=4 part of the url. I have searched the forums but can't find any reference to how to target a specific tab when submitting a form.
    Any help much appreciated.
    Thanks
    John

    Hi
    Thanks for your patience.
    Because there are 8 tabs on this page there is a lot of code, much of it irrelevant, so I have copied below the chunks which relate to this part of the page.
    When the form is submitted the data being returned from the database is correct and is loaded into the page. It is just that the page loads the first tab and you then have to click on the 'Results' tab to see the data which has been returned.
    Ok, from the top of the page the php code which filters the recordset is as follows;
    <?php
    if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
      if (PHP_VERSION < 6) {
        $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
      $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
      switch ($theType) {
        case "text":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;   
        case "long":
        case "int":
          $theValue = ($theValue != "") ? intval($theValue) : "NULL";
          break;
        case "double":
          $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
          break;
        case "date":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;
        case "defined":
          $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
          break;
      return $theValue;
    // recordset for results
    $var1_rsCompResults = "-1";
    if (isset($_GET["event_ID"])) {
      $var1_rsCompResults = $_GET["event_ID"];
    $var2_rsCompResults = "-1";
    if (isset($_GET["age_group"])) {
      $var2_rsCompResults = $_GET["age_group"];
    $var3_rsCompResults = "-1";
    if (isset($_GET["gender"])) {
      $var3_rsCompResults = $_GET["gender"];
    mysql_select_db($database_connPublic, $connPublic);
    $query_rsCompResults = sprintf("SELECT tblResults.result_ID, DATE_FORMAT(tblEvents.event_start_date, '%%Y') AS year, tblResults.event_ID, tblEvents.event_name, tblResults.age_group, tblResults.points, tblIndividuals.forename, tblIndividuals.surname, tblIndividuals.sex FROM tblEvents INNER JOIN tblResults ON tblEvents.event_id = tblResults.event_ID INNER JOIN tblIndividuals ON tblResults.individual_ID = tblIndividuals.individual_id WHERE tblResults.event_ID = %s AND age_group = %s AND sex = %s ORDER BY tblResults.points", GetSQLValueString($var1_rsCompResults, "int"),GetSQLValueString($var2_rsCompResults, "text"),GetSQLValueString($var3_rsCompResults, "text"));
    $rsCompResults = mysql_query($query_rsCompResults, $connPublic) or die(mysql_error());
    $row_rsCompResults = mysql_fetch_assoc($rsCompResults);
    $totalRows_rsCompResults = mysql_num_rows($rsCompResults);
    ?>
    then the links to the Spry Assets and the  js which creates the datasets is as follows;
    <script src="../SpryAssets/SpryTabbedPanels.js" type="text/javascript"></script>
    <script src="../SpryAssets/SpryURLUtils.js" type="text/javascript"></script>
    <script src="../SpryAssets/SpryData.js" type="text/javascript"></script>
    <script src="../SpryAssets/SpryDataExtensions.js" type="text/javascript"></script>
    <script src="../SpryAssets/SpryHTMLDataSet.js" type="text/javascript"></script>
    <script src="../SpryAssets/SpryNestedXMLDataSet.js" type="text/javascript"></script>
    <script src="../SpryAssets/SpryXML.js" type="text/javascript"></script>
    <script src="../SpryAssets/SpryTabbedPanels.js" type="text/javascript"></script>
    <script src="../SpryAssets/SpryPagedView.js" type="text/javascript"></script>
    <script src="../SpryAssets/xpath.js" type="text/javascript"></script>
    <script type="text/javascript">
    var dsYears = new Spry.Data.XMLDataSet("competitions_year_data_xml.php", "root/row");
    var dsCompetitions = new Spry.Data.XMLDataSet("calendar_competitions_data_xml.php", "root/row[year = '{dsYears::year}']");
    var dsAgeGroups = new Spry.Data.XMLDataSet("competitions_age_group_data_xml.php", "root/row[event_ID = '{dsCompetitions::event_ID}']");
    var dsGender = new Spry.Data.XMLDataSet("competitions_sex_data_xml.php", "root/row[age_group = '{dsAgeGroups::age_group}']");
    </script>
    Then the html which creates the tabbed region is as follows;
                      <div id="TabbedPanels1" class="TabbedPanels">
                          <ul class="TabbedPanelsTabGroup">
                            <li class="TabbedPanelsTabLeft" tabindex="0">News</li>
                            <li class="TabbedPanelsTab" tabindex="1">Calendar</li>
                            <li class="TabbedPanelsTab" tabindex="2">Rules</li>
                            <li class="TabbedPanelsTab" tabindex="3">Competition Entries</li>
                            <li class="TabbedPanelsTab" tabindex="4">Results</li>
                            <li class="TabbedPanelsTab" tabindex="5">Rankings</li>
                            <li class="TabbedPanelsTab" tabindex="6">Contacts</li>
                            <li class="TabbedPanelsTabRight" tabindex="7">FAQ</li>
                          </ul>
                          <div class="TabbedPanelsContentGroup">
    Then the form which includes the four select statements is as follows;
    <div class="TabbedPanelsContent" id ="results_data">
                   <h3>Results</h3>
    <form name="selectForm" action="index.php?tab=4&" method="get">
            Year:
    <span spry:region="dsYears" id="yearSelector">
            <select spry:repeatchildren="dsYears" spry:choose="spry:choose" name="year" onchange="dsYears.setCurrentRowNumber(this.selectedIndex);">
                <option value="{year}" spry:when="{ds_CurrentRowID} == {ds_RowID}" selected="selected">{year}</option>
                <option value="{year}" spry:default="spry:default" >{year}</option>
            </select>
    </span>
            Event:
    <span spry:region="dsCompetitions" id="eventSelector">
            <select spry:repeatchildren="dsCompetitions" name="event_ID" onchange="dsCompetitions.setCurrentRowNumber(this.selectedIndex);">
                <option value="{event_ID}">{event_name}</option>
            </select>
    </span>
            Age Groups:
    <span spry:region="dsAgeGroups" id="agegroupSelector">
            <select spry:repeatchildren="dsAgeGroups" name="age_group" onchange="dsAgeGroups.setCurrentRowNumber(this.selectedIndex);">
                <option value="{age_group}">{age_group}</option>
            </select>
    </span>
            Gender:
    <span spry:region="dsGender" id="genderSelector">
            <select spry:repeatchildren="dsGender" name="gender">
                <option value="{sex}">{sex}</option>
            </select>
    </span>
    <input type="submit" value="Submit" />
    </form>
    <?php if ($totalRows_rsCompResults > 0) { // Show if recordset not empty ?>
      <div id="result_ID" name="result_ID">
        <table>
          <tr>
            <th>Athlete Name</th>
            <th>Event</th>
            <th>Score</th>
          </tr>
          <?php do { ?>
            <tr>
              <td><?php echo $row_rsCompResults['forename']; ?> <?php echo $row_rsCompResults['surname']; ?></td>
              <td><?php echo $row_rsCompResults['event_name']; ?></td>
              <td><?php echo $row_rsCompResults['points']; ?></td>
            </tr>
            <?php } while ($row_rsCompResults = mysql_fetch_assoc($rsCompResults)); ?>
        </table>
      </div>
      <?php } // Show if recordset not empty ?>
           </div> <!-- end of TabbedPanelsContent div Results -->
    Then at the end of the page is this code;
    <script type="text/javascript">
    var TabbedPanels1 = new Spry.Widget.TabbedPanels("TabbedPanels1", {defaultTab: params.tab ? params.tab : 0});
    </script>
    </body>
    </html>
    <?php
    mysql_free_result($rsCompResults);
    ?> 

  • Show image in or possibly out suggest

    Hi everybody,
    I guess that since nobody answered my previous post that
    maybe it's was to long to solve or to complex for a forum solution.
    My other solution to my problem would be to show an image
    selected in the "dropdown" from my autosuggest instantly.
    I tried to show thumbnails in the menu as show in the example
    but it loads all my picture (2400 right now)
    I would like to choose a pic in my menu and the picture to
    show on a separate layer in my page
    i show you my code:
    <div id="productSampleContains" class="container">
    Entrez quelques lettres du produit
    recherch&eacute;.<br />
    <form method="get" action="phponlyworking.php">
    <input type="text" id="blahblahblah" />
    <div id="productMenuContains"
    spry:region="dsProducts5">
    <div spry:repeat="dsProducts5"
    spry:suggest="{name}">{name}</div>
    </div>
    </form>
    </div>
    <script type="text/javascript">
    var as5 = new
    Spry.Widget.AutoSuggest("productSampleContains",
    "productMenuContains", "dsProducts5", 'name', {containsString:
    true,hoverSuggestClass:'highlight',minCharsType: 4});
    </script>
    And for my XML
    <?php
    $hostname_conn = "localhost";
    $database_conn = "pubs_gm";
    $username_conn = "root";
    $password_conn = "";
    $conn = mysql_pconnect($hostname_conn, $username_conn,
    $password_conn) or trigger_error(mysql_error(),E_USER_ERROR);
    ?>
    <?php
    // Query the database and get all the records from the Images
    table
    mysql_select_db($database_conn, $conn);
    $query_rsImages = "SELECT
    `nom_image`,`ID_image`,`fichier_image`FROM tbl_images";
    $rsImages = mysql_query($query_rsImages, $conn) or
    die(mysql_error());
    $row_rsImages = mysql_fetch_assoc($rsImages);
    $totalRows_rsImages = mysql_num_rows($rsImages);
    // Send the headers
    header('Content-type: text/xml');
    header('Pragma: public');
    header('Cache-control: private');
    header('Expires: -1');
    ?><?php echo('<?xml version="1.0"
    encoding="iso-8859-1"?>'); ?>
    <products>
    <?php if ($totalRows_rsImages > 0) { // Show if
    recordset not empty ?>
    <?php do { ?>
    <product>
    <category><?php echo $row_rsImages['ID_image'];
    ?></category>
    <name><?php echo $row_rsImages['nom_image'];
    ?></name>
    <boximage><?php echo
    $row_rsImages['fichier_image']; ?></boximage>
    </product>
    <?php } while ($row_rsImages =
    mysql_fetch_assoc($rsImages)); ?>
    <?php } // Show if recordset not empty ?>
    </products>
    <?php
    mysql_free_result($rsImages);
    ?>
    thanks for any help...have a nice week

    Hi Deep,
    An image type UDF only stores the image name in the database. When you add an image, the SBO client takes a copy of the image file and puts it in the Pictures folder (as defined in General Settings). Therefore, to use dynamic images in Crystal you will need to do the following:
    1) Create a formula in Crystal that combines the image name from the UDF field and the path to the Pictures folder to create the full path to the image (note: your Pictures folder must use a UNC or mapped drive path rather than a local path). It's easiest just to hardcode the path to the Pictures folder in the report but you'll have to bear in mind that this setting is company database specific. If you want to be able to run the report for multiple SBO databases then you may need to use a formula to change the path (you could add the OADM table to the report but there is no suitable join between this table and other tables in the database. The report would work because there is only ever 1 record in OADM but it's not good report design).
    2) Once you have your formula you can add a add a picture to the body of the report (at this point you should select a default image)
    3) Right-click the picture on the layout and choose Format Graphic.
    4) Select the Picture tab and click on the formula button to the right of the Graphic Location property
    5) In the formula window set the return value to the formula you created in step 1.
    6) At this point your image will dynamically change based on the UDF value. You may want to set a formula in the Suppress property of the image so that the default image is hidden if the UDF field is blank for a particular record.
    Kind Regards,
    Owen

  • Limiting search results to show results based off of entry in a catgory.

    I am working of someones previous search query, and now the company wants it to be more limited to what is viewed.  I have multiple users in a database and each user has a state assigned to them. I do not want the user when doing a search, to have the results comeback and show all results for every state. The States are defined in the database category as follows. IL, IA, FL, NV.  There will never be anything in this category but these. Below is the code that I am trying to modify to limit the result to the specific state they are using. This is current page for searching in IA. What do I need to change so it will search all search terms, but limit the results to only show for that state.  Thanks in advance.
    <?php require_once('../Connections/forms.php'); ?>
    <?php include('inc_auth.php') ?>
    <?php
    if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
      $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
      $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
      switch ($theType) {
        case "text":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;   
        case "long":
        case "int":
          $theValue = ($theValue != "") ? intval($theValue) : "NULL";
          break;
        case "double":
          $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
          break;
        case "date":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;
        case "defined":
          $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
          break;
      return $theValue;
    $colname_subcat3 = "-1";
    if (isset($_GET['Category'])) {
      $colname_subcat3 = (get_magic_quotes_gpc()) ? $_GET['Category'] : addslashes($_GET['Category']);
    $colname1_subcat3 = "-1";
    if (isset($_GET['SubCat1'])) {
      $colname1_subcat3 = (get_magic_quotes_gpc()) ? $_GET['SubCat1'] : addslashes($_GET['SubCat1']);
    $colname2_subcat3 = "-1";
    if (isset($_GET['SubCat2'])) {
      $colname2_subcat3 = (get_magic_quotes_gpc()) ? $_GET['SubCat2'] : addslashes($_GET['SubCat2']);
    $colname3_subcat3 = "-1";
    if (isset($_GET['SubCat3'])) {
      $colname3_subcat3 = (get_magic_quotes_gpc()) ? $_GET['SubCat3'] : addslashes($_GET['SubCat3']);
    mysql_select_db($database_forms, $forms);
    $query_subcat3 = sprintf("SELECT * FROM `forms` WHERE Category = %s and SubCat1 = %s and SubCat2 = %s and SubCat3 = %s ORDER BY Description ASC", GetSQLValueString($colname_subcat3, "text"),GetSQLValueString($colname1_subcat3, "text"),GetSQLValueString($colname2_subcat3, "text"),GetSQLValueString($colname3_subcat3, "text"));
    $subcat3 = mysql_query($query_subcat3, $forms) or die(mysql_error());
    $row_subcat3 = mysql_fetch_assoc($subcat3);
    $totalRows_subcat3 = mysql_num_rows($subcat3);
    $colname_category = "-1";
    if (isset($_GET['Category'])) {
      $colname_category = (get_magic_quotes_gpc()) ? $_GET['Category'] : addslashes($_GET['Category']);
    mysql_select_db($database_forms, $forms);
    $query_category = sprintf("SELECT * FROM `forms` WHERE Category = %s ", GetSQLValueString($colname_category, "text"));
    $category = mysql_query($query_category, $forms) or die(mysql_error());
    $row_category = mysql_fetch_assoc($category);
    $totalRows_category = mysql_num_rows($category);
    $colname_subcat1 = "-1";
    if (isset($_GET['Category'])) {
      $colname_subcat1 = (get_magic_quotes_gpc()) ? $_GET['Category'] : addslashes($_GET['Category']);
    $colname1_subcat1 = "-1";
    if (isset($_GET['SubCat1'])) {
      $colname1_subcat1 = (get_magic_quotes_gpc()) ? $_GET['SubCat1'] : addslashes($_GET['SubCat1']);
    mysql_select_db($database_forms, $forms);
    $query_subcat1 = sprintf("SELECT * FROM `forms` WHERE Category = %s and SubCat1 = %s ORDER BY Description ASC", GetSQLValueString($colname_subcat1, "text"),GetSQLValueString($colname1_subcat1, "text"));
    $subcat1 = mysql_query($query_subcat1, $forms) or die(mysql_error());
    $row_subcat1 = mysql_fetch_assoc($subcat1);
    $totalRows_subcat1 = mysql_num_rows($subcat1);
    $colname_subcat2 = "-1";
    if (isset($_GET['Category'])) {
      $colname_subcat2 = (get_magic_quotes_gpc()) ? $_GET['Category'] : addslashes($_GET['Category']);
    $colname1_subcat2 = "-1";
    if (isset($_GET['SubCat1'])) {
      $colname1_subcat2 = (get_magic_quotes_gpc()) ? $_GET['SubCat1'] : addslashes($_GET['SubCat1']);
    $colname2_subcat2 = "-1";
    if (isset($_GET['SubCat2'])) {
      $colname2_subcat2 = (get_magic_quotes_gpc()) ? $_GET['SubCat2'] : addslashes($_GET['SubCat2']);
    mysql_select_db($database_forms, $forms);
    $query_subcat2 = sprintf("SELECT * FROM `forms` WHERE Category = %s and SubCat1 = %s and SubCat2 = %s ORDER BY Description ASC", GetSQLValueString($colname_subcat2, "text"),GetSQLValueString($colname1_subcat2, "text"),GetSQLValueString($colname2_subcat2, "text"));
    $subcat2 = mysql_query($query_subcat2, $forms) or die(mysql_error());
    $row_subcat2 = mysql_fetch_assoc($subcat2);
    $totalRows_subcat2 = mysql_num_rows($subcat2);
    $colname_subcat4 = "-1";
    if (isset($_POST['searchbox'])) {
      $colname_subcat4 = (get_magic_quotes_gpc()) ? $_POST['searchbox'] : addslashes($_POST['searchbox']);
    $colname6_subcat4 = "-1";
    if (isset($_POST['searchbox'])) {
      $colname6_subcat4 = (get_magic_quotes_gpc()) ? $_POST['searchbox'] : addslashes($_POST['searchbox']);
    $colname1_subcat4 = "-1";
    if (isset($_POST['searchbox'])) {
      $colname1_subcat4 = (get_magic_quotes_gpc()) ? $_POST['searchbox'] : addslashes($_POST['searchbox']);
    $colname2_subcat4 = "-1";
    if (isset($_POST['searchbox'])) {
      $colname2_subcat4 = (get_magic_quotes_gpc()) ? $_POST['searchbox'] : addslashes($_POST['searchbox']);
    $colname3_subcat4 = "-1";
    if (isset($_POST['searchbox'])) {
      $colname3_subcat4 = (get_magic_quotes_gpc()) ? $_POST['searchbox'] : addslashes($_POST['searchbox']);
    $colname4_subcat4 = "-1";
    if (isset($_POST['searchbox'])) {
      $colname4_subcat4 = (get_magic_quotes_gpc()) ? $_POST['searchbox'] : addslashes($_POST['searchbox']);
    $colname5_subcat4 = "-1";
    if (isset($_POST['searchbox'])) {
      $colname5_subcat4 = (get_magic_quotes_gpc()) ? $_POST['searchbox'] : addslashes($_POST['searchbox']);
    mysql_select_db($database_forms, $forms);
    $query_subcat4 = sprintf("SELECT * FROM `forms` WHERE Title LIKE CONCAT('%%', %s, '%%') or Description LIKE CONCAT('%%', %s, '%%') or Category LIKE CONCAT('%%', %s, '%%') or SubCat1 LIKE CONCAT('%%', %s, '%%') or SubCat2 LIKE CONCAT('%%', %s, '%%') or SubCat3 LIKE CONCAT('%%', %s, '%%') or Keywords LIKE CONCAT('%%', %s, '%%') ORDER BY Description ASC", GetSQLValueString($colname_subcat4, "text"),GetSQLValueString($colname1_subcat4, "text"),GetSQLValueString($colname2_subcat4, "text"),GetSQLValueString($colname3_subcat4, "text"),GetSQLValueString($colname4_subcat4, "text"),GetSQLValueString($colname5_subcat4, "text"),GetSQLValueString($colname6_subcat4, "text"));
    $subcat4 = mysql_query($query_subcat4, $forms) or die(mysql_error());
    $row_subcat4 = mysql_fetch_assoc($subcat4);
    $totalRows_subcat4 = mysql_num_rows($subcat4);
    // date format function
    function makeStamp($theString) {
      if (ereg("([0-9]{4})-([0-9]{2})-([0-9]{2}) ([0-9]{2}):([0-9]{2}):([0-9]{2})", $theString, $strReg)) {
        $theStamp = mktime($strReg[4],$strReg[5],$strReg[6],$strReg[2],$strReg[3],$strReg[1]);
      } else if (ereg("([0-9]{4})-([0-9]{2})-([0-9]{2})", $theString, $strReg)) {
        $theStamp = mktime(0,0,0,$strReg[2],$strReg[3],$strReg[1]);
      } else if (ereg("([0-9]{2}):([0-9]{2}):([0-9]{2})", $theString, $strReg)) {
        $theStamp = mktime($strReg[1],$strReg[2],$strReg[3],0,0,0);
      return $theStamp;
    function makeDateTime($theString, $theFormat) {
      $theDate=date($theFormat, makeStamp($theString));
      return $theDate;
    // end date format function
    ?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <?php include('inc_titleia.php') ?>
    <link href="styles.css" rel="stylesheet" type="text/css">
    </head>
    <body>
    <div id="banneria"></div>
    <div id="container">
        <div id="left">
    <?php include('inc_formselectoria.php') ?>
        </div> <!-- end left -->
        <div id="right">
    <?php if ($totalRows_subcat4 == 0) { // Show if recordset empty ?>
      <p class="largebold">Sorry.Not found.</p>
    <?php } // Show if recordset empty ?>
    <?php if ($totalRows_subcat4 > 0) { // Show if recordset not empty ?>
      <p class="largebold"></p>
          <?php do { ?>
    <a href="../members/uploads/<?php echo $row_subcat4['File']; ?>">        <div id="subleft">Download <br>
      <br>
    </div>
                <div id="subcenter"><?php echo $row_subcat4['Title']; ?><br>
                  <?php echo $row_subcat4['Description']; ?></div>
                <div id="subright">Updated <?php echo makeDateTime($row_subcat4['Date'], 'm/d/Y'); ?></div>        </a>    <div id="clear">        </div>
            <hr><?php } while ($row_subcat4 = mysql_fetch_assoc($subcat4)); ?>
      <?php } // Show if recordset not empty ?>
          </div><!-- end right -->
      <div id="clear">        </div>
    </div><!-- end container -->
    </body>
    </html>
    <?php
    mysql_free_result($subcat3);
    mysql_free_result($category);
    mysql_free_result($subcat1);
    mysql_free_result($subcat2);
    mysql_free_result($subcat4);
    ?>

    >The search box being used allows the users to enter any phrase and the
    >search script searches against all these tables for keywords, form numbers, names, etc
    Does the form have a single search field?
    >My problem is. Lets say I am logged in using the state IA...
    Assuming that the 'form' table has a state field, you just need to include that in the WHERE clause. You can either get that when you log in, by retrieving it from the user table, or, by joining the two tables together in the query. The latter assumes that there is a relationship between user and form.
    But again, I suggest as a first step to clean up the mess that you already have. The person that created this did not understand what they were doing.

  • Group by month/year from DATE FORMAT column

    Hi Chaps,
    I have a recordset that pulls data from a database, then presents the data in a table. The data is grouped by 'projid', repeated for every 'projid', with a show/hide control, to show all the 'jobid's' relating to that particular 'projid'
    This is what I have so far:
    Code:
    SELECT             
    tbl_projects.projid,
    tbl_projects.projtitle,
    tbl_projects.projdue, DATE_FORMAT(tbl_projects.projdue, '%%d/%%m/%%Y') as projdue_format,
    tbl_projects.projtype, 
    tbl_projects.projinvtype,
    tbl_projects.FK_custid,
    tbl_projects.projcompletedate
    tbl_languaget.langtname,
    tbl_doctype.doctypename,
    tbl_jobs.jobid,
    tbl_jobs.FK_projid,              
    tbl_jobs.jobname,              
    tbl_jobs.FK_langid,              
    tbl_jobs.jobpages,              
    tbl_jobs.jobshipped,
    tbl_jobs.jobinvsent,   
    tbl_jobs.jobtranslatorcharge,    
    'tbl_jobs' as fromtable,
    tbl_customers.custid,
    FROM tbl_projects  
    INNER JOIN tbl_jobs              
    ON tbl_projects.projid=tbl_jobs.FK_projid  
    INNER JOIN tbl_languaget              
    ON tbl_languaget.langtid=tbl_jobs.FK_langid  
    INNER JOIN tbl_customers              
    ON tbl_customers.custid=tbl_projects.FK_custid
    INNER JOIN tbl_costs
    ON tbl_costs.FK_custid=tbl_customers.custid 
    INNER JOIN tbl_doctype
    ON tbl_doctype.doctypeid=tbl_jobs.FK_doctypeid
    WHERE tbl_projects.projstatus='Complete'        
    AND tbl_projects.projinvtype='Costing Sheet'
    AND langtname!='TH'
    AND langtname!='ID'
    AND langtname!='KO'
    AND langtname!='JP'
    AND jobinvsent='y'
    AND FK_custid = %s
    ORDER BY projid ASC", GetSQLValueString($colname_rsInvPending, "int");
    $rsInvPending = mysql_query($query_rsInvPending, $conndb2) or die(mysql_error());
    //$row_rsInvPending = mysql_fetch_assoc($rsInvPending);
    $totalRows_rsInvPending = mysql_num_rows($rsInvPending);
    Code:
    // REPEAT - FOR EVERY PROJECT
      <?php
      $previousProject = '';
      if ($totalRows_rsInvPending > 0) {
      // Show if recordset not empty
        while ($row_rsInvPending = mysql_fetch_assoc($rsInvPending)) {
          if ($previousProject != $row_rsInvPending['projid']) {
          // for every Project, show the Project ID
      ?>
    Code:
    // SHOW/HIDE CONTROL
        <tr>
        <td colspan="9" class="highlight"><span class="blueBold"><a href="#" onclick="toggle2('proj1<?php echo $row_rsInvPending['projid'] ?>', this)"><img src="../../Images/plus.gif" border="0" /></a> <?php echo $row_rsInvPending['projid'] ?> - </a></span><span class="blueNOTBold"><em><?php echo $row_rsInvPending['projtitle'] ?></em></span></td>
        </tr>
    Code:
    // SHOW/HIDE
        <?php $previousProject = $row_rsInvPending['projid']; } ?>
        <tr class="proj1<?php echo $row_rsInvPending['projid'] ?>" style="display:none">
        <td>column 1</td>
        <td>column 2</td>
    What I want, is to put in another grouped by stage, where the 'projid's' themselves are in a show/hide region, grouped by 'projcompletedate' (year/month). 'projcompletedate' is in DATE format, but how to I get PHP/SQL to take the month and year and then group them correctly?

    Hi David, I'm not sure if I've got this right, would you mind looking at my latest code?:
    <table border="0" cellpadding="0" cellspacing="0" id="tblinvoice">
        <tr>
          <th>Job Title</th>
          <th>Type</th>
          <th>Language</th>
          <th>Translator</th>
          <th>Total</th>
          <th>Full</th>
          <th>Fuzzy</th>
          <th>Proof</th>
          <th>Full Price</th>
          <th>Discount Price</th>
          <th>Document Format</th>
          <th>Pages</th>
          <th>Typesetting Cost</th>
          <th>EN Proofreading Cost</th>
          <th>Total</th>
          <th>Translator Charge</th>
          <th>Profit</th>
          <th>Profit Percentage</th>
        </tr>
        <?php
          $previousMonth = '';
          if ($totalRows_rsInvPending > 0) {
          // Show if recordset not empty
          do ($row_rsInvPending = mysql_fetch_assoc($rsInvPending)) {
          if ($previousMonth != $row_rsInvPending['themonth']) {
          // for every Month, show the Month Name
       ?>
        <tr>
          <td colspan="18" class="highlight"><?php echo $row_rsInvPending['theyear'] ?> - <?php echo $row_rsInvPending['themonth'] ?></td>
        </tr>
        <?php $previousMonth = $row_rsInvPending['themonth']; } ?>
        <?php
          $previousProject = '';
          if ($totalRows_rsInvPending > 0) {
          // Show if recordset not empty
          while ($row_rsInvPending = mysql_fetch_assoc($rsInvPending)) {
          if ($previousProject != $row_rsInvPending['projid']) {
          // for every Project, show the Project ID
       ?>
       <tr>
        <td colspan="18" class="highlight"><span class="blueBold"><a href="#" onclick="toggle2('proj1<?php echo $row_rsInvPending['projid'] ?>', this)"><img src="../../Images/plus.gif" border="0" /></a> <?php echo $row_rsInvPending['projid'] ?> - </a></span><span class="blueNOTBold"><em><?php echo $row_rsInvPending['projtitle'] ?></em></span></td>
        </tr>
        <?php $previousProject = $row_rsInvPending['projid']; } ?>
        <tr class="proj1<?php echo $row_rsInvPending['projid'] ?>" style="display:none">
            <td><?php echo $row_rsInvPending['jobname']; ?></td>
            <td><?php echo $row_rsInvPending['projtype']; ?></td>
            <td><?php echo $row_rsInvPending['langtname']; ?></td>
            <td><?php echo $row_rsInvPending['translator']; ?></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
          </tr>
          <?php } while ($row_rsInvPending = mysql_fetch_assoc($rsInvPending)); ?>
          <?php } // Show if recordset not empty ?>

Maybe you are looking for

  • Error while creating AW using DBMS_LOB with XML..

    Hi All, I am trying to create AW using DBMS_LOB package with XML, while creating AW,i am facing the following error.find the code also below : declare xml_awcreate_clob clob; xml_awcreate_st varchar2(4000); begin DBMS_LOB.CREATETEMPORARY(xml_awcreate

  • Internal Order Report  S_ALR_87012993 showing settled cost

    HI , The issue here is related to IO report  S_ALR_87012993 showing up settled cost against a particular Cost Element/GL account. However when we use the drill down function it says "No actual Line Item exist". I have checked the line item details fo

  • What is best filter to change the brightness of a clip?

    I am working with a video footage that was shot with no light on and the footage is kind of dark. Is there a filter that can be used to make the clip look brighter. I've tried using the brightness filter but when used the clip does not look rite. It

  • BAdi to change fields in cProjects dashboard

    Can anyone tell me which BAdi's are used to fill/change data on cProjects dashboard? I tried DPR_ATTRIBUTES , DPR_EVE_ATTRIBUTES and DPR_EVE_DASHBOARD. Only DPR_EVE_ATTRIBUTES  was triggered during external debugging but it has only import parameters

  • HT1430 I cannot send or recieve emails since ios6 update

    I cannot send or receive emails since update?