karl_009 Posted February 17, 2009 Share Posted February 17, 2009 Hello, I have been working on a form that updates data from a mysql database, but I keep getting an error which is; Warning: Wrong parameter count for mysql_result() in C:\wamp\www\cmstesting\contact_up_ac.php on line 32 ERROR The code; <?php require ($_SERVER['DOCUMENT_ROOT']."cmstesting/config/db_config.php"); $connection = @mysql_connect ($db_host, $db_user, $db_pass) or die ("Error with Connection"); mysql_select_db ($db_name, $connection); $conid = $_POST["conid"]; $title = $_POST["title"]; $first = $_POST["first"]; $last = $_POST["last"]; $suffix = $_POST["suffix"]; $company = $_POST["company"]; $address1 = $_POST["address1"]; $address2 = $_POST["address2"]; $city = $_POST["city"]; $town = $_POST["town"]; $country = $_POST["country"]; $postcode = $_POST["postcode"]; $website = $_POST["website"]; $email = $_POST["email"]; $hp1 = $_POST["hp1"]; $hp2 = $_POST["hp2"]; $hp3 = $_POST["hp3"]; $mp1 = $_POST["mp1"]; $mp2 = $_POST["mp2"]; $mp3 = $_POST["mp3"]; $notes = $_POST["notes"]; $query = "UPDATE contacts SET title='$title', first='$first', last='$last', suffix='$suffix', compnay='$company', address1='$address1', address2='$address2', city='$city', town='$town', country='$country', postcode='$postcode', website='$website', email='$email', hp1='$hp1', hp2='$hp2', hp3='$hp3', mp1='$mp1', mp2='$mp2', mp3='$mp3', notes='$notes' WHERE conid='$conid'"; $result = mysql_result ($query); if ($result) { echo "Successful"; echo "<BR>"; echo "<a href='contect_view.php'>View</a>"; } else { echo "ERROR"; } ?> Thank in advance for any help. Karl Link to comment https://forums.phpfreaks.com/topic/145649-solved-wrong-parameter-count-for-mysql_result-update-mysql-db/ Share on other sites More sharing options...
Mchl Posted February 17, 2009 Share Posted February 17, 2009 Perhaps check the examples in the manual for mysql_query Link to comment https://forums.phpfreaks.com/topic/145649-solved-wrong-parameter-count-for-mysql_result-update-mysql-db/#findComment-764621 Share on other sites More sharing options...
premiso Posted February 17, 2009 Share Posted February 17, 2009 mysql_query is what you need to use. As far as your mysql_connect I would highly suggest not using the error suppressor (@) sign. It is not good coding practice, on production you should change "Display Errors" to off instead. Link to comment https://forums.phpfreaks.com/topic/145649-solved-wrong-parameter-count-for-mysql_result-update-mysql-db/#findComment-764622 Share on other sites More sharing options...
karl_009 Posted February 18, 2009 Author Share Posted February 18, 2009 Hello, I have changed mysql_result to mysql_query an I have also commented out the if statement at the bottem yet when I try and submit alted data I get this; Warning: Wrong parameter count for mysql_query() in C:\wamp\www\cmstesting\contact_up_ac.php on line 32 UPDATE contacts SET title='MR', first='UPDATED', last='TEST', suffix='J', compnay='TEST', address1='TEST 01', address2='TEST 02', city='TEST', town='TW', country='', postcode='TESTSTS', website='www.website.com', email='[email protected]', hp1='7654', hp2='654', hp3='7565', mp1='875', mp2='765', mp3='5764', notes='' WHERE conid='29' In this error you can see the field I have updated which is first='UPDATED' but this dose not get to the database any ideas, I have gone though the manual but cant find anything. Thanks for any help Karl Link to comment https://forums.phpfreaks.com/topic/145649-solved-wrong-parameter-count-for-mysql_result-update-mysql-db/#findComment-764777 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.