www.webdeveloper.com
Results 1 to 3 of 3

Thread: [RESOLVED] Mysql... more then 1 update...

  1. #1
    Join Date
    Jan 2006
    Location
    England UK
    Posts
    200

    resolved [RESOLVED] Mysql... more then 1 update...

    Hi,

    I didnt know how to remove [RESOLVED] on my previous thread... otherwise i would of put this there...

    but anyways, i was able to make 1 update work but when i was writing this i must of missed something.

    I add NogDogs Error reporting as well so you will know my error...

    My code:

    PHP Code:
    <?php
        
        
    if(!isset($_POST['dbhost']) || empty($_POST['dbhost'])) {     }
        if(!isset(
    $_POST['dbuser']) || empty($_POST['dbuser'])) {     }
        if(!isset(
    $_POST['dbpass']) || empty($_POST['dbpass'])) {     }
        if(!isset(
    $_POST['dbname']) || empty($_POST['dbname'])) {     }
        if(!isset(
    $_POST['prefix']) || empty($_POST['prefix'])) {     }

        
    $server $_POST['dbhost'];
        
    $dbusername $_POST['dbuser'];
        
    $dbpassword $_POST['dbpass'];
        
    $db_name $_POST['$dbname'];
        
    $pv $_POST['prefix'];   

        
    $connection=mysql_connect($server$dbuser$dbpass);
        
    mysql_select_db($dbname$connection);

        
    error_reporting(E_ALL);

        
    $results1=mysql_query("INSERT INTO ".$pv."config (name, value, comment, kind, options, title, category, cat_order)  VALUES ('catcase','0','Change Category Case For Your New Categories','list','0|Exact^1|ALL UPPER CASE^2|all lower case','Category Text Case','02|Categories','2')"$connection) or die(mysql_error());
        
    $results2=mysql_query("INSERT INTO ".$pv."config (name, value, comment, kind, options, title, category, cat_order)  VALUES ('showpagerankgoogle','1','Show Google Page Rank, below URL','flag','','Search Engine Information - Google Page Rank','03|Links','10')"$connection) or die(mysql_error());    
        
        
    $query ="UPDATE ".$pv."config SET value = '3.31' WHERE name = 'recipman_version'";
        
    $query ="UPDATE ".$pv."config SET cat_order = '3' WHERE name = 'catfilesep'";
        
    $query ="UPDATE ".$pv."config SET cat_order = '4' WHERE name = 'showcounters'";
        
    $query ="UPDATE ".$pv."config SET cat_order = '5' WHERE name = 'dispsubcat'";
        
    $query ="UPDATE ".$pv."config SET cat_order = '6' WHERE name = 'showcatdesc'";
        
    $query ="UPDATE ".$pv."config SET comment = 'Show Alexa Traffic Rank, below URL, below URL', title = 'Search Engine Information - Alexa Traffic Rank', cat_order = '9' WHERE name = 'showpagerank'";
        
    $query ="UPDATE ".$pv."config SET cat_order = '11' WHERE name = 'showrecip'";
        
    $query ="UPDATE ".$pv."config SET cat_order = '12' WHERE name = 'linkstatus'";
        
    $query ="UPDATE ".$pv."config SET cat_order = '13' WHERE name = 'showlinktotal'";
        
    $query ="UPDATE ".$pv."config SET cat_order = '14' WHERE name = 'displinktotal'";

        
    $results3 mysql_query($query,$connection) or die(mysql_error()."<br />QUERY: $query"); 
        if(
    mysql_affected_rows() == 0
        { 
            
    $query2 "SELECT * FROM ".$pv."config WHERE name = 'recipman_version'"
            
    $result2 mysql_query($query2) or die(mysql_error()."<br />QUERY: $query2"); 
            if(
    mysql_num_rows($result2) == 0
            { 
                
    trigger_error("ERROR: no matches in ".$pv."config for name = 'recipman_version'"E_USER_WARNING); 
            } 
            else 
            { 
                
    trigger_error("ERROR: no rows updated for unknown reason in table ".$pv."config"E_USER_WARNING); 
            } 
        } 
        
        
    mysql_close($connection);

        echo 
    "<BR><BR>";

        if (
    $results1 != "1") {
            echo 
    "Could Not Instert New Row - Google Page Rank<BR><BR>";
        } else {
            echo 
    "Updated: Insterted New - Google Page Rank<BR><BR>";
        }

            if (
    $results2 != "1") {
            echo 
    "Could Not Instert New Row - Category Case Change<BR><BR>";
        } else {
            echo 
    "Updated: Insterted New Row - Category Case Change<BR><BR>";
        }

        if (
    $results3 != "1") {
            echo 
    "Could Not Update Existing Rows<BR><BR>";
        } else {
            echo 
    "Updated Existing Rows<BR><BR>";
        }

        echo 
    "<BR><BR>";

        echo 
    "<font size=\"4\">Upgrade Completed!</font><BR><BR><font color=\"#FF0000\" size=\"-1\">Now Delete The Upgrade-SQL Folder</font>";


                
    ?>
    and the error i get is:

    Warning: ERROR: no rows updated for unknown reason in table rl_config in /home/xpixalc/public_html/rm/Upgrade-SQL/upgrade-330to331.php on line 129

    Updated Existing Rows
    Thanks
    Aaron

  2. #2
    Join Date
    Jan 2006
    Location
    England UK
    Posts
    200
    I have tried... over 20 didnt tutorials... and i still get the damn thing to work...

    all i want is those to insterts to instert... which they do... and the updates... to update which dont work!!

    please help.

    thanks
    Aaron

  3. #3
    Join Date
    Jan 2006
    Location
    England UK
    Posts
    200
    done it... !!

    PHP Code:
    <?php
        
        
    if(!isset($_POST['dbhost']) || empty($_POST['dbhost'])) {     }
        if(!isset(
    $_POST['dbuser']) || empty($_POST['dbuser'])) {     }
        if(!isset(
    $_POST['dbpass']) || empty($_POST['dbpass'])) {     }
        if(!isset(
    $_POST['dbname']) || empty($_POST['dbname'])) {     }
        if(!isset(
    $_POST['prefix']) || empty($_POST['prefix'])) {     }

        
    $server $_POST['dbhost'];
        
    $dbusername $_POST['dbuser'];
        
    $dbpassword $_POST['dbpass'];
        
    $db_name $_POST['$dbname'];
        
    $pv $_POST['prefix'];   

        
    $connection=mysql_connect($server$dbuser$dbpass);
        
    mysql_select_db($dbname$connection);

        
    $results1=mysql_query("INSERT INTO ".$pv."config (name, value, comment, kind, options, title, category, cat_order)  VALUES ('catcase','0','Change Category Case For Your New Categories','list','0|Exact^1|ALL UPPER CASE^2|all lower case','Category Text Case','02|Categories','2')"$connection) or die(mysql_error()); 
        
    $results2=mysql_query("INSERT INTO ".$pv."config (name, value, comment, kind, options, title, category, cat_order)  VALUES ('showpagerankgoogle','1','Show Google Page Rank, below URL','flag','','Search Engine Information - Google Page Rank','03|Links','10')"$connection) or die(mysql_error());     
         
        
    $sql ="UPDATE ".$pv."config SET value = '3.31' WHERE name = 'recipman_version'";
        
    $results3 = @mysql_query($sql,$connection) or die(mysql_error());
        
    $sqla ="UPDATE ".$pv."config SET cat_order = '3' WHERE name = 'catfilesep'"
        
    $results3a = @mysql_query($sqla,$connection) or die(mysql_error());
        
    $sqls ="UPDATE ".$pv."config SET cat_order = '4' WHERE name = 'showcounters'"
        
    $results3s = @mysql_query($sqls,$connection) or die(mysql_error());
        
    $sqld ="UPDATE ".$pv."config SET cat_order = '5' WHERE name = 'dispsubcat'"
        
    $results3d = @mysql_query($sqld,$connection) or die(mysql_error());
        
    $sqlw ="UPDATE ".$pv."config SET cat_order = '6' WHERE name = 'showcatdesc'"
        
    $results3w = @mysql_query($sqlw,$connection) or die(mysql_error());
        
    $sqlr ="UPDATE ".$pv."config SET comment = 'Show Alexa Traffic Rank, below URL, below URL', title = 'Search Engine Information - Alexa Traffic Rank', cat_order = '9' WHERE name = 'showpagerank'"
        
    $results3r = @mysql_query($sqlr,$connection) or die(mysql_error());
        
    $sqlg ="UPDATE ".$pv."config SET cat_order = '11' WHERE name = 'showrecip'"
        
    $results3g = @mysql_query($sqlg,$connection) or die(mysql_error());
        
    $sqll ="UPDATE ".$pv."config SET cat_order = '12' WHERE name = 'linkstatus'"
        
    $results3l = @mysql_query($sqll,$connection) or die(mysql_error());
        
    $sqlp ="UPDATE ".$pv."config SET cat_order = '13' WHERE name = 'showlinktotal'"
        
    $results3p = @mysql_query($sqlp,$connection) or die(mysql_error());
        
    $sqlo ="UPDATE ".$pv."config SET cat_order = '14' WHERE name = 'displinktotal'"
        
    $results3o = @mysql_query($sqlo,$connection) or die(mysql_error());
        
        
    mysql_close($connection);

        echo 
    "<BR><BR>";

        if (
    $results1 != "1") {
            echo 
    "Could Not Instert New Row - Google Page Rank<BR><BR>";
        } else {
            echo 
    "Updated: Insterted New - Google Page Rank<BR><BR>";
        }

            if (
    $results2 != "1") {
            echo 
    "Could Not Instert New Row - Category Case Change<BR><BR>";
        } else {
            echo 
    "Updated: Insterted New Row - Category Case Change<BR><BR>";
        }

        if (
    $results3 != "1") {
            echo 
    "Could Not Add New Rows<BR><BR>";
        } else {
            echo 
    "Added New Rows<BR><BR>";
        }

        echo 
    "<BR><BR>";

        echo 
    "<font size=\"4\">Upgrade Completed!</font><BR><BR><font color=\"#FF0000\" size=\"-1\">Now Delete The Upgrade-SQL Folder</font>";


                
    ?>
    Thanks for reading
    Aaron

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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

"

"

X vBulletin 4.2.2 Debug Information

  • Page Generation 0.11995 seconds
  • Memory Usage 2,947KB
  • Queries Executed 13 (?)
More Information
Template Usage (34):
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_global_above_footer
  • (1)ad_global_below_navbar
  • (1)ad_global_header1
  • (1)ad_global_header2
  • (1)ad_navbar_below
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)ad_thread_first_post_content
  • (1)ad_thread_last_post_content
  • (2)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)headinclude_bottom
  • (3)memberaction_dropdown
  • (1)navbar
  • (4)navbar_link
  • (1)navbar_moderation
  • (1)navbar_noticebit
  • (1)navbar_tabs
  • (2)option
  • (3)postbit
  • (3)postbit_onlinestatus
  • (3)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available (6):
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files (26):
  • ./showthread.php
  • ./global.php
  • ./includes/class_bootstrap.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/functions_navigation.php
  • ./includes/class_friendly_url.php
  • ./includes/class_hook.php
  • ./includes/class_bootstrap_framework.php
  • ./vb/vb.php
  • ./vb/phrase.php
  • ./includes/functions_facebook.php
  • ./includes/functions_calendar.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_notice.php
  • ./packages/vbattach/attach.php
  • ./vb/types.php
  • ./vb/cache.php
  • ./vb/cache/db.php
  • ./vb/cache/observer/db.php
  • ./vb/cache/observer.php 

Hooks Called (70):
  • init_startup
  • friendlyurl_resolve_class
  • init_startup_session_setup_start
  • database_pre_fetch_array
  • database_post_fetch_array
  • init_startup_session_setup_complete
  • global_bootstrap_init_start
  • global_bootstrap_init_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • load_show_variables
  • load_forum_show_variables
  • global_state_check
  • global_bootstrap_complete
  • global_start
  • style_fetch
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • strip_bbcode
  • friendlyurl_clean_fragment
  • friendlyurl_geturl
  • forumjump
  • cache_templates
  • cache_templates_process
  • template_register_var
  • template_render_output
  • fetch_template_start
  • fetch_template_complete
  • parse_templates
  • fetch_musername
  • notices_check_start
  • notices_noticebit
  • process_templates_complete
  • friendlyurl_redirect_canonical
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • memberaction_dropdown
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • build_navigation_data
  • build_navigation_array
  • check_navigation_permission
  • process_navigation_links_start
  • process_navigation_links_complete
  • set_navigation_menu_element
  • build_navigation_menudata
  • build_navigation_listdata
  • build_navigation_list
  • set_navigation_tab_main
  • set_navigation_tab_fallback
  • navigation_tab_complete
  • fb_like_button
  • showthread_complete
  • page_templates