Results 1 to 11 of 11

database error

This is a discussion on database error within the General Discussion forums, part of the vBSEO SEO Plugin category; Hi, vbseo staff know that i'm not expert, i'm receiving this error from my database: Code: Warning : mysql_result(): supplied ...

  1. #1
    Senior Member
    Real Name
    Riccardo
    Join Date
    Jun 2008
    Posts
    267
    Liked
    1 times

    database error

    Hi,
    vbseo staff know that i'm not expert,
    i'm receiving this error from my database:
    Code:
    Warning: mysql_result(): supplied argument is not a valid MySQL result
    Before i have rceived this other errors from my database that i fix changing mysql_query with vbulletin database class, however: $db->query() instead of mysql_query and the 2 first warning was fixed.

    Now what is the correct vb database class code for replace the function mysql_result() in vb db class?

    Thanks

  2. #2
    Senior Member Shadab's Avatar
    Real Name
    Shadab
    Join Date
    Oct 2007
    Location
    Bhopal
    Posts
    821
    Liked
    0 times
    Blog Entries
    12
    Handy guide : vBulletin API Basics: Variables, Functions, Objects

    See the second heading "$db (Type: Object)"

  3. #3
    Senior Member
    Real Name
    Riccardo
    Join Date
    Jun 2008
    Posts
    267
    Liked
    1 times
    Thanks for your reply,
    do you know what will be a valid MySql resource to replace my string:
    Code:
    $announcement = (mysql_result($announcements, 0, 0));
    to fix:
    Code:
    Warning: mysql_result(): supplied argument is not a valid MySQL result resource
    Thanks for any help,
    i'm crazyng from 10 days, only today i have solved the first 2 warnings, but this one is very hardest for an not expert like me.

  4. #4
    Senior Member Shadab's Avatar
    Real Name
    Shadab
    Join Date
    Oct 2007
    Location
    Bhopal
    Posts
    821
    Liked
    0 times
    Blog Entries
    12
    Try something like this :

    PHP Code:
    $var $db->query_first("SELECT blah FROM table WHERE clause"DBARRAY_NUM) ;

    $announcement $var[0] ; 

  5. #5
    vBSEO.com Webmaster Mert Gökçeimam's Avatar
    Real Name
    Lizard King
    Join Date
    Oct 2005
    Location
    Istanbul, Turkey, Turkey
    Posts
    23,100
    Liked
    622 times
    Blog Entries
    4
    If it is a vBulletin powered page , use the following query

    PHP Code:
    $var $db->query_read_slave("SELECT blah FROM table WHERE clause"DBARRAY_NUM) ;

    $announcement $var[0] ; 
    Last edited by Mert Gökçeimam; 03-02-2009 at 01:13 PM.
    Mert Gökçeimam / Crawlability Inc.

    vBSEO 3.6.0 Alpha Önizlemesi - Including Like Tree
    Unveiling the NEW vBSEO Sitemap Generator 3.0 - available NOW for vBSEO Customers!


    Twitter:@Depkac
    Personal Blog : Mert Gökçeimam

  6. #6
    Senior Member
    Real Name
    Riccardo
    Join Date
    Jun 2008
    Posts
    267
    Liked
    1 times
    thanks for the reply,
    but now there's a sintax error,
    SELECT blah FROM table WHERE clause

    What is the exact content?

    Thanks again

  7. #7
    Senior Member Shadab's Avatar
    Real Name
    Shadab
    Join Date
    Oct 2007
    Location
    Bhopal
    Posts
    821
    Liked
    0 times
    Blog Entries
    12
    SELECT blah FROM table WHERE clause
    It was just a sample.
    Replace it with the actual SQL query/statement that you want to run.

  8. #8
    Senior Member
    Real Name
    Riccardo
    Join Date
    Jun 2008
    Posts
    267
    Liked
    1 times
    Ok,
    understand,
    but i'm not expert,
    if anybody want to said me how can i do for found the replacement of
    SELECT blah FROM table WHERE clause

    Will be great.

    Thanks

  9. #9
    vBSEO.com Webmaster Mert Gökçeimam's Avatar
    Real Name
    Lizard King
    Join Date
    Oct 2005
    Location
    Istanbul, Turkey, Turkey
    Posts
    23,100
    Liked
    622 times
    Blog Entries
    4
    If you donot explain what you want to do , noone can asist you.
    Mert Gökçeimam / Crawlability Inc.

    vBSEO 3.6.0 Alpha Önizlemesi - Including Like Tree
    Unveiling the NEW vBSEO Sitemap Generator 3.0 - available NOW for vBSEO Customers!


    Twitter:@Depkac
    Personal Blog : Mert Gökçeimam

  10. #10
    Senior Member
    Real Name
    Riccardo
    Join Date
    Jun 2008
    Posts
    267
    Liked
    1 times
    Quote Originally Posted by Mert Gökçeimam View Post
    If you donot explain what you want to do , noone can asist you.
    You have 2000 ragions

    I know that my problem is not seo realated, for this i don't have writed all before, but if you can help me again, will be great.

    My problem is related to a third part mod that i have need to complete my forum.
    I' have request support on this forum , because this problem is not solved from vb.org , they said that the problem not exist,and that is a DB problem but no, this problem is related to the hack and not to the my db, because the hack it was writed without vb db class in these 2 lines.

    Only for this i have thinked to post in here, where i always found a solution for all my problems, related and not to vbseo.

    The whole script of the smnlikquick (the name of the hack) is this and it is located in the [path]/Admincp folder (in red the line that cause my problem and in green the line that i have solved):

    Code:
    <?php 
    // ++ ============================================================= ++
    //                 SmnLikQuick v2.0.5
    // ++ ============================================================= ++
    
    error_reporting(E_ALL & ~E_NOTICE);
    @set_time_limit(0);
     
    $phrasegroups = array('style');
    $specialtemplates = array('products');
     
    require_once('./global.php');
    
    $vbulletin->input->clean_array_gpc('r', array(
                'id'              => TYPE_UINT,
                'slq_status'      => TYPE_UINT,
                'slq_order'          => TYPE_UINT,
                'slq_title'          => TYPE_STR,
                'slq_message'      => TYPE_STR,
            ));
    
    // #######################################
    // #### START MAIN SCRIPT   #####################
    // #######################################
    $do = $_REQUEST['do'];
    
    print_cp_header("SmnLikQuick");
    
    ?><script type="text/javascript">
    function doSelected(action, id) 
    {
        var val = action.options[action.selectedIndex].value;
    
        if(val == 1)
        window.location = 'smnlikquick.php?do=edit_announcement&id=' + id;
        if(val == 2)
        window.location = 'smnlikquick.php?do=disable_announcement&id=' + id;
        if(val == 3)
        window.location = 'smnlikquick.php?do=delete_announcement&id=' + id;
        if(val == 4)
        window.location = 'smnlikquick.php?do=enable_announcement&id=' + id;
    }
    </script><?php 
    
    // ##########################################
    // #### ACTIVE ANNOUNCEMENTS  ####################
    // ##########################################
    if (empty($do)) 
    {
        $announcements = $db->query("SELECT count(*) FROM `" . TABLE_PREFIX . "smnlikquick`");
        $announcement = (mysql_result($announcements, 0, 0));
        {
            if ($announcement > 0) 
            {                    
                print_table_start();
                print_table_header($vbphrase['smnlikquick_manage_announcements'], 5);
                
                print_cells_row(array($vbphrase['smnlikquick_title'], $vbphrase['smnlikquick_order'], $vbphrase['smnlikquick_message'], $vbphrase['smnlikquick_controls']), 1, -1);
                
                $announcements = $db->query_read("SELECT * FROM `" . TABLE_PREFIX . "smnlikquick` WHERE `status`='1' ORDER BY `dis_order`");
                while ($announcement = $vbulletin->db->fetch_array($announcements))
                {
                    $cell[0] = $announcement['title'];
                    $cell[1] = $announcement['dis_order'];
                    $cell[2] = $announcement['message'];        
                    $cell[3] = "
                        <select class=\"bginput\" onChange=\"doSelected(this, ".$announcement["id"].")\">
                            <option selected>".$vbphrase['smnlikquick_options']."</option>
                            <option>----------</option>
                            <option value=\"1\">".$vbphrase['edit']."</option>
                            <option value=\"2\">".$vbphrase['disable']."</option>
                            <option value=\"3\">".$vbphrase['delete']."</option>
                        </select>";
        
                    print_cells_row($cell);
                }
                    echo "<tr valign=\"top\" align=\"center\"><td class=\"thead\" align=\"center\" colspan=\"6\">
                            <input type=\"submit\" class=\"button\" tabindex=\"1\" value=\"  Manage Inactive Announcements   \" onclick=\"self.location='smnlikquick.php?do=inactive_announcements'\" />
                          </td></tr>";
                          
                print_table_footer();
            }
        }
    
    // #### ADD NEW ANNOUNCEMENT ####################
    // ======================================================================
        print_form_header('smnlikquick', 'add_announcement', true);
        print_table_header($vbphrase['smnlikquick_create_announcement'], 5);
        print_input_row($vbphrase['smnlikquick_title'], "slq_title", $vbulletin->GPC['slq_title'], 30, 50);
        print_textarea_row($vbphrase['smnlikquick_message'], "slq_message", $vbulletin->GPC['slq_message'], 10, 52);
        print_input_row($vbphrase['smnlikquick_message_order'], "slq_order", $vbulletin->GPC['slq_order'], 30, 50);
        print_yes_no_row($vbphrase['smnlikquick_message_status'], 'slq_status', $vbulletin->GPC['slq_status']);
        print_submit_row();
        print_table_footer(5, '', '', 0);
    }
        
    // #### ADDED NEW ANNOUNCEMENT  ##################
    // ======================================================================
    if ($_REQUEST['do'] == 'add_announcement') 
    {
        $title = $_REQUEST['slq_title'];
        $status = $_REQUEST['slq_status'];
        $order = $_REQUEST['slq_order'];
        $message = $_REQUEST['slq_message'];
        
        $db->query_write("INSERT INTO `" . TABLE_PREFIX . "smnlikquick` 
                        (`title`, `status`, `dis_order`, `message`) 
                        VALUES ('" . $db->escape_string($vbulletin->GPC['slq_title']) . "',
                                '" . $db->escape_string($vbulletin->GPC['slq_status']) . "',
                                '" . $db->escape_string($vbulletin->GPC['slq_order']) . "',
                                '" . $db->escape_string($vbulletin->GPC['slq_message']) . "'
                                                     )
                        ");
                        
        print_cp_message($vbphrase['smnlikquick_announcement_saved_success'], 'smnlikquick.php', 2);
    }
    
    // ##########################################
    // #### INACTIVE ANNOUNCEMENTS ###################
    // ##########################################
    if ($_REQUEST['do'] == 'inactive_announcements') 
    {
        $announcements = mysql_query("SELECT count(*) FROM `" . TABLE_PREFIX . "smnlikquick`");
        $announcement = (mysql_result($announcements, 0, 0));
        {
            if ($announcement > 0) 
            {                    
                print_table_start();
                print_table_header($vbphrase['smnlikquick_manage_announcements'], 5);
                
                print_cells_row(array($vbphrase['smnlikquick_title'], $vbphrase['smnlikquick_order'], $vbphrase['smnlikquick_message'], $vbphrase['smnlikquick_controls']), 1, -1);
                
                $announcements = $db->query_read("SELECT * FROM `" . TABLE_PREFIX . "smnlikquick` WHERE `status`='0' ORDER BY `dis_order`");
                while ($announcement = $vbulletin->db->fetch_array($announcements))
                {
                    $cell[0] = $announcement['title'];
                    $cell[1] = $announcement['dis_order'];
                    $cell[2] = $announcement['message'];        
                    $cell[3] = "
                        <select class=\"bginput\" onChange=\"doSelected(this, ".$announcement["id"].")\">
                            <option selected>".$vbphrase['smnlikquick_options']."</option>
                            <option>----------</option>
                            <option value=\"1\">".$vbphrase['edit']."</option>
                            <option value=\"4\">".$vbphrase['enable']."</option>
                            <option value=\"3\">".$vbphrase['delete']."</option>
                        </select>";
        
                    print_cells_row($cell);
                }
                    echo "<tr valign=\"top\" align=\"center\"><td class=\"thead\" align=\"center\" colspan=\"6\">
                            <input type=\"submit\" class=\"button\" tabindex=\"1\" value=\"  Manage Active Announcements   \" onclick=\"self.location='smnlikquick.php'\" />
                          </td></tr>";
                          
                print_table_footer();
            }
        }
    }
    
    // #### EDIT ANNOUNCEMENT #######################
    // ======================================================================
    if ($_REQUEST['do'] == 'edit_announcement') 
    {
        $id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : -1;
    
        $id = intval($id);
        $announcements = $db->query_read("SELECT * FROM `" . TABLE_PREFIX . "smnlikquick` WHERE `id`='$id'");
        $announcement = $db->fetch_array($announcements);
    
            print_form_header('smnlikquick', 'edited_announcement', true);
            print_table_header($vbphrase['smnlikquick_create_announcement'], 5);
            echo '<input type="hidden" name="id" value="'.$id.'" />';
            print_input_row($vbphrase['smnlikquick_title'], "slq_title", $announcement['title'], 30, 50);
            print_textarea_row($vbphrase['smnlikquick_message'], "slq_message", $announcement['message'], 10, 52);
            print_input_row($vbphrase['smnlikquick_message_order'], "slq_order", $announcement['dis_order'], 30, 50);
            print_yes_no_row($vbphrase['smnlikquick_message_status'], 'slq_status', $announcement['status']);
            print_submit_row();
            print_table_footer(5, '', '', 0);
    
    }
    
    // #### EDITED ANNOUNCEMENT  #####################
    // ======================================================================
    if ($_REQUEST['do'] == 'edited_announcement') 
    {
        $id = $_REQUEST['id'];
        $title = $_REQUEST['slq_title'];
        $status = $_REQUEST['slq_status'];
        $order = $_REQUEST['slq_order'];
        $message = $_REQUEST['slq_message'];
        
        $db->query_write("UPDATE `" . TABLE_PREFIX . "smnlikquick` SET 
                          title='" . $db->escape_string($vbulletin->GPC['slq_title']) . "', 
                          status='" . $db->escape_string($vbulletin->GPC['slq_status']) . "', 
                          dis_order='" . $db->escape_string($vbulletin->GPC['slq_order']) . "',
                          message='" . $db->escape_string($vbulletin->GPC['slq_message']) . "'  
                          WHERE id='" . $db->escape_string($vbulletin->GPC['id']) . "'
                        ");
        
        print_cp_message($vbphrase['smnlikquick_announcement_updated_success'], 'smnlikquick.php', 2);
    }
    
    // #### DELETE ANNOUNCEMENT  #####################
    // ======================================================================
    if ($_REQUEST['do'] == 'delete_announcement') 
    {
        $id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : -1;
        
        $id = intval($id);
        $announcements = $db->query_read("SELECT * FROM `" . TABLE_PREFIX . "smnlikquick` WHERE `id`='$id'");
        $announcement = $db->fetch_array($announcements);
        
        print_table_start();
        echo "<form action=\"smnlikquick.php?do=delete_announcement_final&id=" . $announcement['id'] . "\" method=\"post\" name=\"cpform\" id=\"cpform\">";
        print_table_header($vbphrase['confirm_deletion']);    
       
        echo "<tr valign=\"top\" align=\"center\"><td class=\"alt1\" align=\"left\">
              <p align=\"justify\">Are you <strong>sure</strong> you want to delete the announcement titled <strong>" . $announcement['title'] . "</strong>.</p> 
              <p align=\"justify\">This action can not be undone.</p>
              </td></tr>
              <tr valign=\"top\" align=\"center\"><td class=\"thead\" align=\"center\">
              <input type=\"submit\" class=\"button\" tabindex=\"1\" value=\"  Yes   \" accesskey=\"s\" />
              <input type=\"button\" class=\"button\" value=\"   No   \" tabindex=\"1\" onclick=\"history.back(1);\" />
              </td></tr>";
    
       print_table_footer();    
    }
    
    // #### DELETE ANNOUNCEMENT CONFIRM ###############
    // ======================================================================
    if ($_REQUEST['do'] == 'delete_announcement_final') 
    {
        $id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : -1;
        
        $db->query_write("DELETE FROM `" . TABLE_PREFIX . "smnlikquick` WHERE `id`='" . $db->escape_string($vbulletin->GPC['id']) . "'");
        
        print_cp_message($vbphrase['smnlikquick_announcement_deleted_success'], 'smnlikquick.php', 2);
    }
    
    // #### DISABLE ANNOUNCEMENT  ####################
    // ======================================================================
    if ($_REQUEST['do'] == 'disable_announcement') 
    {
        $id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : -1;
        
        $db->query_write("UPDATE `" . TABLE_PREFIX . "smnlikquick` SET `status`='0' WHERE id='" . $db->escape_string($vbulletin->GPC['id']) . "'");
        
        print_cp_message($vbphrase['smnlikquick_announcement_updated_success'], 'smnlikquick.php', 2);
    }
    
    // #### ENABLE ANNOUNCEMENT #####################
    // ======================================================================
    if ($_REQUEST['do'] == 'enable_announcement') 
    {
        $id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : -1;
        
        $db->query_write("UPDATE `" . TABLE_PREFIX . "smnlikquick` SET `status`='1' WHERE id='" . $db->escape_string($vbulletin->GPC['id']) . "'");
        
        print_cp_message($vbphrase['smnlikquick_announcement_updated_success'], 'smnlikquick.php', 2);
    }
    
    print_cp_footer();
    
    ?>
    Can you suggest me again the replacement of that red line for allow my forum to work with this great hack?

    Thanks in advance

  11. #11
    Senior Member Shadab's Avatar
    Real Name
    Shadab
    Join Date
    Oct 2007
    Location
    Bhopal
    Posts
    821
    Liked
    0 times
    Blog Entries
    12
    FIND:
    PHP Code:
    $announcements $db->query("SELECT count(*) FROM `" TABLE_PREFIX "smnlikquick`");
    $announcement = (mysql_result($announcements00)); 
    REPLACE WITH:
    PHP Code:
    $announcement array_pop($db->query_first("SELECT count(*) FROM `" TABLE_PREFIX "smnlikquick`"DBARRAY_NUM)) ; 

Similar Threads

  1. Database Error.
    By UnderEstimated in forum Troubleshooting
    Replies: 10
    Last Post: 02-18-2009, 07:44 AM
  2. Database error
    By barbaro in forum General Discussion
    Replies: 2
    Last Post: 02-07-2009, 02:30 PM
  3. Database error.
    By ChefTalk in forum Troubleshooting
    Replies: 3
    Last Post: 03-24-2007, 12:05 PM
  4. database error help
    By hornstar6969 in forum General Discussion
    Replies: 1
    Last Post: 02-01-2007, 05:26 AM
  5. database error
    By UnderEstimated in forum Troubleshooting
    Replies: 9
    Last Post: 12-01-2006, 05:46 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •