Jump to content

beanfair

Members
  • Posts

    9
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

beanfair's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. No errors and the var_dump works, returning all expected values. This is driving me crazy.
  2. That was a typo after too many hours staring at the code. Here is the code as it appears on the test page This works [/<?php $meeting = $wpdb->get_row("SELECT *, date_FORMAT(startDate, '%M %e, %Y') as newDate FROM sfa_meetings WHERE meetingID = 163");?> <h3><?php echo $meeting->newDate; ?></h3> <h2><?php echo $meeting->title; ?></h2>php] This does not [code=php:0]<?php $location =$wpdb->get_row("SELECT locID, locName, address, city, zip, drive, locDesc, comments FROM locations WHERE locID =7 ");?> <h3><?php echo $location->locName; ?> </h3> Here is subsequent code on that page <table> <tr><td>Registration Begins</td><td><?php echo $meeting->regTime; ?></td></tr> <tr><td>Business Meeting Begins</td><td><?php echo $meeting->busTime; ?></td></tr> <tr><td>Feature Begins</td><td><?php echo $meeting->featureTime; ?></td></tr> <tr><td>Adjourn</td><td><?php echo $meeting->adjournTime; ?></td></tr> <tr><td>Location</td><td><?php echo $location->locName; ?></td></tr> <tr><td>Address</td><td><?php echo $location->address; ?></td></tr> <tr><td></td><td><?php echo $location->city; ?>, CA <?php echo $location->zip; ?></td></tr> <tr><td>Directions</td><td><?php echo $location->drive; ?></td></tr> <tr><td>Questions?</td><td><?php echo $meeting->email; ?></td></tr> </table> The test page is at http://174.123.219.170/~romancew/meeting-test Thank you!
  3. I have tested both of these queries in PHPMyAdmin and they work great. When I try to call those queries and data bind, one works and one doesn't. I can't see where the problem is. This works <?php $meeting = $wpdb->get_row("SELECT *, date_FORMAT(startDate, '%M %e, %Y') as newDate FROM sfa_meetings WHERE meetingID = 163");?> <h3><?php echo $meeting->newDate; ?></h3> <h2><?php echo $meeting->title; ?></h2> This does not <?php $location =$wpdb->get_row("SELECT locID, locName, address, city, zip, drive, locDesc, comments FROM locations WHERE locID =7 ");?> <h3><?php echo $loc->locName; ?> </h3> I am stumped. Both code blocks appear on this page http://174.123.219.170/~romancew/meeting-test but I have also tried the code blocks on separate pages to make sure they weren't interfering. The first code block works whereever I put it but not the second. Any assistance is appreciated!
  4. First, the paren are to make it easier to read :-) In a nutshell there is a directory table of teachers, one record per teacher. A second table holds the teacher ID as the foreign key in a one to many relationship with one row per teaching location. Some teachers have multiple teaching locations. The large multi-table query creates a recordset of teachers by teacher gender, status and location. That record set populates a table that forms the teacher directory. The teacher directory displays thumbnail, name and one teaching location. That is easy and works great. The problem is that they want ALL of the teaching locations that pertain to a teacher to show in this directory. How to create a table based on a query that returns one record per teacher THEN with in the cell, print the results of ANOTHER recordset that might have 1-4 records per teacher ID
  5. We are working on a website that has a directory of teachers. The specs calls for a page that shows all of the teachers in a specific region. That is the easy part. The database has a main table of practitioners and another table of regions with the ID of the practitioner as the foreign key so practitioners may have multiple regions in which they teach. On a region page, we want the practitioner's picture, name and ALL regions. Getting all of the regions to show is the problem. We are thinking we would need to run another query within the table cell but really want to avoid that. -------------------------------------------------------------------------------- SELECT sacred_ads.sacred_adsID, sacred_ads.adURL, sacred_ads.adName, sacred_ads.practType, sacred_adLabel.adLabel, sacred_ads.thumbnail, sacred_ads.adStatus, sacred_adLocations.adCity, sacred_adLocations.adState, stateRegions.region FROM sacred_ads INNER JOIN (sacred_adLabel INNER JOIN (sacred_adLocations INNER JOIN stateRegions ON stateRegions.stateRegionsID = sacred_adLocations.adState) ON sacred_adLabel.adLabelID = sacred_ads.adLabel) ON sacred_ads.sacred_adsID = sacred_adLocations.sacred_adsID WHERE sacred_ads.adStatus =2 AND stateRegions.region = [[VAL]] AND sacred_ads.practType = [[VAL]]; -------------------------------------------------------------------------------- we use php to dynamically create and populate the table. Basically we need to the the contents of this query -------------------------------------------------------------------------------- SELECT adCity, adState, FROM sacred_adLocations WHERE sacred_adsID = [[VAL]] -------------------------------------------------------------------------------- to the table cell. Any suggestions are most appreciated,
  6. We are working on a website that has a directory of teachers. The specs calls for a page that shows all of the teachers in a specific region. That is the easy part. The database has a main table of practitioners and another table of regions with the ID of the practitioner as the foreign key so practitioners may have multiple regions in which they teach. On a region page, we want the practitioner's picture, name and ALL regions. Getting all of the regions to show is the problem. We are thinking we would need to run another query within the table cell but really want to avoid that. SELECT sacred_ads.sacred_adsID, sacred_ads.adURL, sacred_ads.adName, sacred_ads.practType, sacred_adLabel.adLabel, sacred_ads.thumbnail, sacred_ads.adStatus, sacred_adLocations.adCity, sacred_adLocations.adState, stateRegions.region FROM sacred_ads INNER JOIN (sacred_adLabel INNER JOIN (sacred_adLocations INNER JOIN stateRegions ON stateRegions.stateRegionsID = sacred_adLocations.adState) ON sacred_adLabel.adLabelID = sacred_ads.adLabel) ON sacred_ads.sacred_adsID = sacred_adLocations.sacred_adsID WHERE sacred_ads.adStatus =2 AND stateRegions.region = [[VAL]] AND sacred_ads.practType = [[VAL]]; we use php to dynamically create and populate the table. Basically we need to the the contents of this query SELECT adCity, adState, FROM sacred_adLocations WHERE sacred_adsID = [[VAL]] to the table cell. Any suggestions are most appreciated,
  7. I have a mySQL table of product prices. The table has an autoincrement priceid, a product field, a price field and a date modified field. Each product may appear in the table multiple times, prices vary according to season. I want to query the table so that I have a recordset containing ONLY the latest price per product. If I have 10 products I only want 10 rows returned with the data from the row with the newest date in the datemod field. I have tried lots of things and I usually get just 10 rows but it isn't selecting the correct row per product. I may get the June price for broccoli but the price for strawberries for September of 2004 instead of the latest price for strawberries. The prices are raised at different times for different products so I can't set the where to a certain range or date. Any assistance is appreciated. Thank you
  8. I am updating a table, inserting multiple rows from a previous form. This works and inserts the rows mysql_select_db($database_zen, $zen); $query_rsCC = "INSERT INTO tblPackingList (marketwk, crop, out) SELECT tblPackingListOLD.marketwk, tblCrop.crop, tblPackingListOLD.cc AS out FROM tblCrop INNER JOIN tblPackingListOLD ON tblCrop.cropID = tblPackingListOLD.crop WHERE tblPackingListOLD.marketwk=17 AND tblPackingListOLD.cc>0"; $rsCC = mysql_query($query_rsCC, $zen) or die(mysql_error()); However, I also need to insert values that are concatenation. The concat works and creates the value that I need. SELECT CONCAT("cc",tblPackingListOLD.marketwk, tblCrop.crop) AS pid FROM tblCrop INNER JOIN tblPackingListOLD ON tblCrop.cropID = tblPackingListOLD.crop Now I need help incorporating the concat into the insert query so that (pid, marketwk, crop, out) are inserted Thanks
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.