1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

CREATE TEMPORARY TABLE doesn't seem to work

Discussion in 'PHP' started by countrydj, Apr 1, 2016.

  1. #1
    I have inherited a web site that runs on php / mysql and I am having trouble getting some of it to work.

    This is part of the script:

    
    function make_country_subcats($country,$pcountry,$accommsTable,$superbreakTable,$adsTable,$link,$category,$accommtype,$extra){
    
      if($accommtype=="A"){
      $acctype="";
      }else{
      $acctype=$accommtype;
      }
      $qry  = "CREATE TEMPORARY TABLE tmp (";
      $qry .= "county varchar(60) NOT NULL default '',";
      $qry .= "categories varchar(60) NOT NULL default ''";
      $qry .= ")";
      if(!($results = mysql_query($qry, $link))){
      displayErrMsg(sprintf("Error in executing %s query", $qry));
      displayErrMsg(sprintf("error:%d %s", mysql_errno($link), mysql_error($link)));
      exit();
      }
    $qry="INSERT INTO tmp (county) SELECT county FROM $accommsTable WHERE country = '$country' AND categories LIKE '%$acctype%'";
      if(!($results = mysql_query($qry, $link))){
      displayErrMsg(sprintf("Error in executing %s query", $qry));
      displayErrMsg(sprintf("error:%d %s", mysql_errno($link), mysql_error($link)));
      $qry = "DROP TABLE tmp";
      $results = mysql_query($qry, $link);
        exit();
      }
    
    PHP:


    This is what I get when I run the web page:

    If anybody wants to look at the web site it is: http://www.holidays.org.uk/
    You will then need to click on Directory and then select a category. e.g All Accommodation the England.
    Any help would be very welcome.



    Thanks



    John C
     
    countrydj, Apr 1, 2016 IP
  2. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #2
    Well, the error is there because $acctype is empty. How are you populating it?
     
    PoPSiCLe, Apr 1, 2016 IP