Jump to content

Ansel_Tk1

Members
  • Posts

    43
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Ansel_Tk1's Achievements

Member

Member (2/5)

0

Reputation

  1. Thanks again Pikachu. This got it: SELECT states_provinces_0.StateName AS StateName_1, states_provinces_0.StateID AS StateID_1, listings.*, states_provinces.StateID, states_provinces.StateName FROM ((listings LEFT JOIN states_provinces ON states_provinces.StateID=listings.location1provstate) LEFT JOIN states_provinces AS states_provinces_0 ON states_provinces_0.StateID=listings.location2provstate)
  2. No the last 5 are from the states_provinces table (starting from StateID) but it looks like only the first join is listed. Shouldn't there be a second listing from the states_provinces table from location2provstate?
  3. This is what I got: Array ( [listing_id] => 2 [name] => schoolname [owner] => ownername => emailaddress [website] => website [logo] => [location1address1] => address1 [location1address2] => [location1city] => city [location1provstate] => 740 [location1postal] => M5R 2S7 [location1phone] => 416-555-1212 [location1fax] => [location1tollfree] => [location1long] => [location1lat] => [location1prim] => 1 [location2address1] => [location2address2] => [location2city] => City [location2provstate] => 742 [location2postal] => [location2phone] => [location2fax] => [location2tollfree] => [location2long] => [location2lat] => [location2prim] => [costperweekfrom] => 630 [costperweekto] => [agefrom] => 5 [ageto] => 11 [capacity] => 90 [optionslist] => [description] => [createddate] => 2011-01-08 15:02:00 [published] => 1 [stateID] => 742 [stateCountryID] => 2 [stateAbbrev] => QC [stateName] => Quebec [stateTax] => 0.00000 ) So it looks like the second JOIN is not outputting here?
  4. Thank you for taking the time to help me Pikachu Both headers are named StateName but when I use <?php echo $row_Recordset1['StateName']; ?><?php echo $row_Recordset1['StateName']; ?> I get the same value for both (and the first one is correct). But when I try <?php echo $row_Recordset1['states_provinces.StateName']; ?><?php echo $row_Recordset1['states_provinces_0.StateName']; ?> I get nothing for either.
  5. Thanks Pikachu - yes I have and both queries return the correct data from the StateName fields. This is why I am stumped!
  6. Hi - wondering if someone could help me out here... I've tried both: SELECT listings.*, states_provinces.*, states_provinces_0.* FROM ((listings LEFT JOIN states_provinces ON states_provinces.StateID=listings.location1provstate) LEFT JOIN states_provinces AS states_provinces_0 ON states_provinces_0.StateID=listings.location2provstate) and SELECT listings.*, states_provinces.*, states_provinces_0.* FROM listings LEFT JOIN states_provinces ON states_provinces.StateID=listings.location1provstate LEFT JOIN states_provinces AS states_provinces_0 ON states_provinces_0.StateID=listings.location2provstate But neither <?php echo $row_Recordset1['states_provinces.StateName']; ?> or <?php echo $row_Recordset1['states_provinces_0.StateName']; ?> give me anything! I know the data is good in the lookup table and <?php echo $row_Recordset1['listings.locationXprovstate']; ?> returns the right StateID values. What the heck am I doing wrong? Many thanks for any assistance.
  7. I love simple logic. That makes sense. Although I am trying this but need to work out how to specify the actual day (todays date): SELECT * FROM newssubscribe_details WHERE contestid = %s AND newssubscribe_id = %s AND dateandtime = DATE(NOW())
  8. Hi - wondering if someone out there can give me some guidance. I'm trying to select only those rows where my datetime field is less than or equal to 1 calendar day of todays date (not 24hrs). Basically, I am making a contest entry form where you can only enter the contest once every calendar day. This is what I am using now but the logic seems messed up: SELECT * FROM newssubscribe_details WHERE contestid = %s AND newssubscribe_id = %s AND dateandtime <= CURRENT_DATE() - INTERVAL 1 day Any help would be really appreciated! Thanks.
  9. Hi - wondering if someone can give a little guidance: Why doesn't this trim the whitespace out of the string postzip? trim(strtoupper(((isset($_POST["postzip"]))?$_POST["postzip"]:""))) Thanks
  10. Hi - wonder if someone could point out what I've done wrong here? function Trigger_chkip(&$tNG) { //redirect to quizcaptcha.php $usripsallowed = 14; if($totalRows_usrips > $usripsallowed) { $redObj = new tNG_Redirect($tNG); $redObj->setURL('quiz-captcha.php'); $redObj->setKeepURLParams(false); return $redObj->Execute(); } else return true; } For some reason the script never directs to quiz-captcha.php even though $totalRows_usrips returns greater than 14. If I change the greater than to an equal it works. Any help would be appreciated. Thanks
  11. Just one question - is CONCAT exclusive of all other fields in the table when it is used? i.e. does: SELECT CONCAT(boomcms_mstlst_sections.section_name, ' ', boomcms_content_articles.smm_ct_title) AS smm_ct_titlewd only select boomcms_mstlst_sections.section_name and boomcms_content_articles.smm_ct_title within those two tables and ignores all other fields in both tables within the query? I ask because I need to also obtain the field boomcms_content_articles.smm_ct_article_id however I think (maybe I am wrong?) since it is not within the CONCAT it is not selected? I don't want boomcms_content_articles.smm_ct_article_id to be added to the CONCAT though. Can CONCAT be combined with SELECT * somehow? I've been searching on the mySQL commands documentation but am having trouble locating a reference of combining the two. Thank you so much for any help. Dan
  12. Thank you so much rhodesa. And I love the McGuyver photo.
  13. Hi - wondering if someone out there can help? Can CONCAT be used before JOIN to define the the two fields to be combined? Here is what I have so far: SELECT CONCAT(boomcms_mstlst_sections.section_id, ' ', boomcms_content_articles.smm_ct_title) AS smm_ct_titlewd FROM boomcms_content_articles, boomcms_mstlst_sections LEFT JOIN boomcms_mstlst_sections ON boomcms_mstlst_sections.section_id=boomcms_content_articles.section_name) and I get the error Not unique table/alias: 'boomcms_mstlst_sections' Any help would be really appreciated.
×
×
  • 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.