ERROR: SELECT cat_id, cat_name FROM in Wordpress Bolg

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • deephill
    New Member
    • Feb 2007
    • 37

    ERROR: SELECT cat_id, cat_name FROM in Wordpress Bolg

    hi
    I am getting SELECT cat_id, cat_name FROM Error in Wordpress Blog. Im getting below error in my online site. Wht can i do?

    WordPress database error: [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 '' at line 1]
    SELECT cat_id, cat_name FROM
    Sample template i am viewing Blogrolls. But in online site i cant. The code is...

    [PHP]<?php
    $link_cats = $wpdb->get_results("S ELECT cat_id, cat_name FROM $wpdb->linkcategories ");
    foreach ($link_cats as $link_cat) {
    ?>
    <div class="widget_s tyle" id="links_with_ style">
    <div class="cats_hea d">
    <h2 class="h3">cat_ name; ?>
    </div>
    <ul>
    <?php get_links($link _cat->cat_id, '', '', '
    ', FALSE, 'rand', TRUE,
    TRUE, -1, TRUE); ?>
    </ul>
    </div>
    <?php } ?> [/PHP]


    Anybody help me?
  • devsusen
    New Member
    • Feb 2007
    • 136

    #2
    Hi,

    [PHP]$link_cats = $wpdb->get_results("S ELECT cat_id, cat_name FROM $wpdb->linkcategories ");[/PHP]

    I think you r not getting the file name using $wpdb->linkcategori es

    try to print out the query using

    [PHP]echo "SELECT cat_id, cat_name FROM $wpdb->linkcategories "[/PHP]

    susen

    Comment

    • deephill
      New Member
      • Feb 2007
      • 37

      #3
      Thank you...

      im newbie. can u tell clearly. i.e. whr did i put this???
      :-(

      Comment

      • devsusen
        New Member
        • Feb 2007
        • 136

        #4
        put the 2nd line of just above the 1st line of code. Now see if u r getting the sql query printed properly or not.

        susen

        Comment

        • deephill
          New Member
          • Feb 2007
          • 37

          #5
          hi.. i put like this. but its same error. wht should i do?

          [PHP]<?php
          $link_cats = $wpdb->get_results("S ELECT cat_id, cat_name FROM $wpdb->linkcategories ");
          echo "SELECT cat_id, cat_name FROM $wpdb->linkcategories ";
          foreach ($link_cats as $link_cat) {
          ?>
          <div class="widget_s tyle" id="links_with_ style">
          <div class="cats_hea d">
          <h2 class="h3">cat_ name; ?>
          </div>
          <ul>
          <?php get_links($link _cat->cat_id, '', '', '
          ', FALSE, 'rand', TRUE,
          TRUE, -1, TRUE); ?>
          </ul>
          </div>
          <?php } ?> [/PHP]

          Comment

          • deephill
            New Member
            • Feb 2007
            • 37

            #6
            hi i put like this.
            [PHP]<?php
            $link_cats = $wpdb->get_results("S ELECT cat_id, cat_name FROM $wpdb->linkcategories ");
            echo "SELECT cat_id, cat_name FROM $wpdb->linkcategories ";
            foreach ($link_cats as $link_cat) {
            ?>
            <div class="widget_s tyle" id="links_with_ style">
            <div class="cats_hea d">
            <h2 class="h3">cat_ name; ?>
            </div>
            <ul>
            <?php get_links($link _cat->cat_id, '', '', '
            ', FALSE, 'rand', TRUE,
            TRUE, -1, TRUE); ?>
            </ul>
            </div>
            <?php } ?> [/PHP]

            now i am getting below message in the sidebar.php....



            Code:
            WordPress database error: [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 '' at line 1]
            			SELECT cat_id, cat_name FROM 
            
             			
            SELECT cat_id, cat_name FROM

            Comment

            • devsusen
              New Member
              • Feb 2007
              • 136

              #7
              HI,

              so what I told u earlier that u r not getting value of $wpdb->linkcategories .

              So first search if u have a table named wp_linkcategori es in ur database or not. Now if the table is there then search wp-config.php or wp-settings.php files for the variable.

              IMHO u should go for updating wordpress application for blog.

              susen

              Comment

              • Motoma
                Recognized Expert Specialist
                • Jan 2007
                • 3236

                #8
                You may want to try setting your query to: "SELECT cat_id, cat_name FROM {$wpdb->linkcategories }"

                Comment

                Working...