
- You are not logged in. | Login
January 18, 2007 1:00 pm
- mastaweb99
- Member


Data changing
I need to add some changes to the database. I'm trying to do this using the following code:
<?php
if(isset($_POST['reg'])) {
$id=$_POST['id'];
$name=$_POST['name'];
$author=$_POST['author'];
$news=$_POST['news'];
$date=$_POST['date'];
}
$dbhost ="localhost";
$dbuser ="root";
$dbpassword ="root";
$dbname ="db";
$link = mysql_connect($dbhost, $dbuser, $dbpassword);
$query = "update news set name='$name', author='$author', news='$news', date='$date' where id='$id'";
$result = mysql_query($query, $link) or die(mysql_error());
?>But nothing happens
January 18, 2007 1:05 pm
- mdwb
- Member


Re: Data changing
Try to insert in the beginning of the script:
error_reporting(E_ALL);
Don't be afraid of life, it is yours!
January 18, 2007 1:20 pm
- mdwb
- Member


Re: Data changing
Have you set the error_reporting()?
Does anything happen?
Show print ($query);
Don't be afraid of life, it is yours!
January 18, 2007 1:20 pm
- mastaweb99
- Member


Re: Data changing
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'where id='1'' at line 1
January 18, 2007 1:22 pm
- mastaweb99
- Member


Re: Data changing
Oh, I've done it! 
Thanks for everybody
Last edited by mastaweb99 (January 18, 2007 1:26 pm)


