Re: insert data -



VitaminB wrote:
I try to insert data from a form into a mysql database, but it did not
work...


There is no error,

I think you mean: "I didn't print the error," :)

but the data did not pass thru the table.
<snip>
$result = mysql_query("INSERT INTO wholocations(íd', 'lat',
'lon','description', ówner', çity', 'street', 'zip', çountry')
VALUES('0',
'".$Lat."','".$Lon."','".$Name."' , '".$Owner."' ,'".$City."'
,'".$Street."' ,'".$ZIP."' ,'".$Country."')");

If there is an error in your SQL statement, $result will be false and

echo $result;

this echo will be the same as <?php echo false; ?>
You need to test the return value of mysql_query()

if ($result === false) {
echo 'There was an error in the SQL statement. ';
echo 'The error was: ', mysql_error(), "].<br>\n";
}

mysql_error();
<snip>

--
I (almost) never check the dodgeit address.
If you *really* need to mail me, use the address in the Reply-To
header with a message in *plain* *text* *without* *attachments*.
.



Relevant Pages

  • Re: Need help finding a bug...
    ... Anthony wrote: ... entered into the database. ... When I echo the sql statement being ... Check the return value of mysql_queryto determine whether an error occurred, and if so echo the result of mysql_error. ...
    (comp.lang.php)
  • Need help finding a bug...
    ... program to auto-assign a number to the field if it is. ... entered into the database. ... When I echo the sql statement being ...
    (comp.lang.php)
  • Re: [PHP] passing form information.
    ... at the last echo ... secondly I would rewrite the sql statement to read ... This is my php code... ...
    (php.general)
  • Re: interesting problem
    ... > when encountering things like this i always echo the sql statement ... > just befor the query is executed ...
    (alt.php)
  • Re: [PHP] passing form information.
    ... it the primary key for the table. ... at the last echo ... >secondly I would rewrite the sql statement to read ... This is my php code... ...
    (php.general)