Jump to content

[SOLVED] Wrong parameter count for mysql_result() - UPDATE MySQL DB


Recommended Posts

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

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.

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='blah@blah.com', 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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.