Forum Moderators: coopster
How do i make it only amend the result i want it to?
also on the success screen it comes up with this error
Warning: mysqli_close() expects exactly 1 parameter, 0 given in /homepages/16/d88487104/htdocs/veritas/test/amend-script.php on line 64
Many Thanks
$title = $_POST['title'];
$salary = $_POST['salary'];
$desc = $_POST['description'];
$short = $_POST['short'];
$end = $_POST['end_date'];
$location = $_POST['location'];
$con = mysqli_connect("#*$!x", "#*$!x", "#*$!x", "#*$!x");
$query = "UPDATE job_board SET title = '$title', salary = '$salary', description = '$desc', short = '$short', end_date = '$end', location = '$location'";
mysqli_query($con, $query) or die("Can't execute insert query: " . mysqli_error());
?>
$query = "UPDATE job_board SET title = '$title', salary = '$salary', description = '$desc', short = '$short', end_date = '$end', location = '$location'";
add a hidden input type for the job_board_id or whatever is the primary key of the job_board table and add this too at the end of $query
where job_board_id = $_POST['job_board_id']
II have done a little research and found this is usually because the user hasn't got privaledges to access the database.
I know this isn't true for me as it updated the fields before just not the right ones, so whats going on?
I'm stumped
$id = $_POST['id'];
$title = $_POST['title'];
$salary = $_POST['salary'];
$desc = $_POST['description'];
$short = $_POST['short'];
$end = $_POST['end_date'];
$location = $_POST['location'];
heres the new version of the code
$con = mysqli_connect("#*$!x", "#*$!x", "#*$!x", "#*$!x");
$query = "UPDATE job_board SET title = '$title', location = '$location', salary = '$salary', end_date = '$end', description = '$desc', short = '$short' where job_board_id = '$id'";
mysql_query($query, $con) or die("Can't execute insert query: " . mysql_error());
change job_board_id for the column name in that table. Change the connection to the write username and db too.
<?php
$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
$dbname = ('db_you_want_to_use',$link);
mysql_select_db($dbname);
?>
What does that say? Don't forget to change the username and password to the correct ones in the code above...Change db_you_want_to_us to the name of your database.
If that works all fine, try putting your query and stuff after that and give it a go...
[edited by: Pico_Train at 11:25 am (utc) on July 3, 2009]
$query = "UPDATE job_board SET title = '$title', location = '$location', salary = '$salary', end_date = '$end', description = '$desc', short = '$short' where job_board_id = '$id'";
mysql_query($query) or die("Can't execute insert query: " . mysql_error());