Jump to content

PDM

Members
  • Posts

    12
  • Joined

  • Last visited

    Never

Posts posted by PDM

  1. I'm having a problem copying data from fields that contain html code.

     

    I'm getting the data from the table using php and can output it to the browser without problem.

     

     
              $thisPostDate = $row_GetBlogBase['PostDate'];
      $thisCategory = $row_GetBlogBase['Category'];
      $thisAuthorName = $row_GetBlogBase['AuthorName'];
      $thisAuthorEmail = $row_GetBlogBase['AuthorEmail'];
      $thisTitle = $row_GetBlogBase['Title'];
      $thisDesc = $row_GetBlogBase['Desc'];
      $thisKeywords = $row_GetBlogBase['Keywords'];
      $thisHeadline = $row_GetBlogBase['Headline'];
      $thisIntro = $row_GetBlogBase['Intro'];
      $thisNewsStory = $row_GetBlogBase['NewsStory'];
    				  
    $insertSQL = "INSERT INTO news_blog (PostDate, Category, AuthorName, AuthorEmail, Title, `Desc`, Keywords, Headline, Intro, NewsStory) VALUES ('$thisPostDate', '$thisCategory', '$thisAuthorName', '$thisAuthorEmail', '$thisTitle', '$thisDesc', '$thisKeywords', '$thisHeadline, '$thisIntro', '$thisNewsStory')";
    
      mysql_select_db($database_MyBLOGS, $MyBLOGS);
      $Result1 = mysql_query($insertSQL, $MyBLOGS) or die(mysql_error());
    

     

    When $thisNewsStory contains html code

    <img src="http://www.myweb.com/images/topleft.gif" align="right" vspace="5" hspace="5" border="1">

    I get a mySQL syntal error like

     

    You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'src="http://www.myweb.com/images/topleft.gif" align="right" vspace="5" hspace="5' at line 1

     

    ???

  2. Mysql 5 or 3

    PHP 3

     

    I have this table jos_content I get a mysql syntax error trying to insert a record

     

    Field            Type              Collation          Null    Key    Default              Extra          Privileges                      Comment

    ----------------  ----------------  -----------------  ------  ------  -------------------  --------------  -------------------------------  -------

    id                int(11) unsigned  (NULL)            NO      PRI    (NULL)              auto_increment  select,insert,update,references       

    title            varchar(100)      latin1_swedish_ci  NO                                                  select,insert,update,references       

    title_alias      varchar(100)      latin1_swedish_ci  NO                                                  select,insert,update,references       

    introtext        mediumtext        latin1_swedish_ci  NO                                                  select,insert,update,references       

    fulltext          mediumtext        latin1_swedish_ci  NO                                                  select,insert,update,references       

    state            tinyint(3)        (NULL)            NO      MUL    0                                    select,insert,update,references       

    sectionid        int(11) unsigned  (NULL)            NO      MUL    0                                    select,insert,update,references       

    mask              int(11) unsigned  (NULL)            NO      MUL    0                                    select,insert,update,references       

    catid            int(11) unsigned  (NULL)            NO      MUL    0                                    select,insert,update,references       

    created          datetime          (NULL)            NO              0000-00-00 00:00:00                  select,insert,update,references       

    created_by        int(11) unsigned  (NULL)            NO              0                                    select,insert,update,references       

    created_by_alias  varchar(100)      latin1_swedish_ci  NO                                                  select,insert,update,references       

    modified          datetime          (NULL)            NO              0000-00-00 00:00:00                  select,insert,update,references       

    modified_by      int(11) unsigned  (NULL)            NO              0                                    select,insert,update,references       

    checked_out      int(11) unsigned  (NULL)            NO      MUL    0                                    select,insert,update,references       

    checked_out_time  datetime          (NULL)            NO              0000-00-00 00:00:00                  select,insert,update,references       

    publish_up        datetime          (NULL)            NO              0000-00-00 00:00:00                  select,insert,update,references       

    publish_down      datetime          (NULL)            NO              0000-00-00 00:00:00                  select,insert,update,references       

    images            text              latin1_swedish_ci  NO                                                  select,insert,update,references       

    urls              text              latin1_swedish_ci  NO                                                  select,insert,update,references       

    attribs          text              latin1_swedish_ci  NO                                                  select,insert,update,references       

    version          int(11) unsigned  (NULL)            NO              1                                    select,insert,update,references       

    parentid          int(11) unsigned  (NULL)            NO              0                                    select,insert,update,references       

    ordering          int(11)          (NULL)            NO              0                                    select,insert,update,references       

    metakey          text              latin1_swedish_ci  NO                                                  select,insert,update,references       

    metadesc          text              latin1_swedish_ci  NO                                                  select,insert,update,references       

    access            int(11) unsigned  (NULL)            NO      MUL    0                                    select,insert,update,references       

    hits              int(11) unsigned  (NULL)            NO              0   

     

    Taking values from a form I get a syntax error with the following code

      $insertSQL = sprintf("INSERT INTO jos_content (title, title_alias, introtext, fulltext, state, sectionid, mask, catid, created, created_by, created_by_alias, modified, modified_by, checked_out, checked_out_time, publish_up, publish_down, images, urls, attribs, version, parentid, ordering, metakey, metadesc, access, hits) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
                           GetSQLValueString($_POST['title'], "text"),
                           GetSQLValueString($_POST['title_alias'], "text"),
                           GetSQLValueString($_POST['introtext'], "text"),
                           GetSQLValueString($_POST['fulltext'], "text"),
                           GetSQLValueString($_POST['state'], "int"),
                           GetSQLValueString($_POST['sectionid'], "int"),
                           GetSQLValueString($_POST['mask'], "int"),
                           GetSQLValueString($_POST['catid'], "int"),
                           GetSQLValueString($_POST['created'], "date"),
                           GetSQLValueString($_POST['created_by'], "int"),
                           GetSQLValueString($_POST['created_by_alias'], "text"),
                           GetSQLValueString($_POST['modified'], "date"),
                           GetSQLValueString($_POST['modified_by'], "int"),
                           GetSQLValueString($_POST['checked_out'], "int"),
                           GetSQLValueString($_POST['checked_out_time'], "date"),
                           GetSQLValueString($_POST['publish_up'], "date"),
                           GetSQLValueString($_POST['publish_down'], "date"),
                           GetSQLValueString($_POST['images'], "text"),
                           GetSQLValueString($_POST['urls'], "text"),
                           GetSQLValueString($_POST['attribs'], "text"),
                           GetSQLValueString($_POST['version'], "int"),
                           GetSQLValueString($_POST['parentid'], "int"),
                           GetSQLValueString($_POST['ordering'], "int"),
                           GetSQLValueString($_POST['metakey'], "text"),
                           GetSQLValueString($_POST['metadesc'], "text"),
                           GetSQLValueString($_POST['access'], "int"),
                           GetSQLValueString($_POST['hits'], "int"));
    
      mysql_select_db($database_connNMFFG, $connNMFFG);
      $Result1 = mysql_query($insertSQL, $connNMFFG) or die(mysql_error());
    

     

    I use The above style code using DreamWeaver with no problem on hundreds of tables but apparently something to do with jos_content table structure that I don't understand is creating a problem.

     

    ???

  3. Found the if problem.

     

    Deleting the ; at the end of the if line fixed that.

     

    Another issue now.

     

    I need to run this same loop with different select strings and 6 different places on the page.

     

    If I try to run the loop a second or third time, at different locations below in the page it fails to return any values.

     

    It seems as if I'm only allow to run the loop once per page????

  4. I'm having trouble figuring out how to select records from my query.

     

    <?php
    mysql_select_db($database_BA, $BA);
    $query_GetPackages = "SELECT * FROM destpackage WHERE DestinationName = 'Lake Guri Resort' ORDER BY PackageName ASC";
    $GetPackages = mysql_query($query_GetPackages, $BA) or die(mysql_error());
    $row_GetPackages = mysql_fetch_assoc($GetPackages);
    $totalRows_GetPackages = mysql_num_rows($GetPackages);
    ?>

     

    I have the above query on a page where I'm using records selected to populate two drop downs.

     

    I'd also like to select other fields from this same query based on specific ID column values.

     

    For example I'd like to output the Price field for a record in the above query where the ID field = 41.

     

    I know I could create another query to do this but I need to do this 6 times for this page and don't want to create 6 times the server load by using 7 queries on the page.

     

    I know this should be real simple but I can't seem to formulate a search phrase correctly to get the answer from a forum or web search.

     

    ???

×
×
  • 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.