/    Sign up×
Community /Pin to ProfileBookmark

[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:

[code=php]
<?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>”;

?>
[/code]

and the error i get is:

[QUOTE]

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

[/QUOTE]

Thanks
Aaron

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@LiL_aaronauthorApr 26.2006 — 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
Copy linkTweet thisAlerts:
@LiL_aaronauthorApr 26.2006 — done it... !! ?

[code=php]
<?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>";



?>
[/code]


Thanks for reading

Aaron
×

Success!

Help @LiL_aaron spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...