FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


how to insert data into mysql base from a web page





pollux1er
I wrote a code to insert data from a web page. Not a formula. But an error occured. this is the code:

<?php
// Connecxion a la base
$base = mysql_connect('imysql03', 'i4143424', '5h173e2mu5nkooqp');
mysql_select_db('i4143424', $base);
?>

<html>
<head>
<title>Insertion dans la base</title>
</head>
<body>
<?php
// lancement de la requete
$sql = "INSERT INTO inscription_newsletter VALUES('', 'MAX', 'BOSSADI', 'max_bossadi@yahoo.fr')";

mysql_query($sql) or die ('Erreur SQL!'.$sql.'<br>'.mysql_error());

mysql_close();
?>
Max vient d'etre insere dans la base.
</body>
</html>

please hel me to know where is the mistake.
The eror reurned is this:

Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING
Philip
ussualy that because theere is not close tag ;

try to replace this one first for testing Smile
it must be work ok Smile
$base = mysql_connect('imysql03', 'i4143424', '5h173e2mu5nkooqp');
$db=mysql_select_db('i4143424', $base);
$sql="select * from table";
mysql_query($sql) with mysql_query($sql,$db);
close($db);
pollux1er
it still doesn't work! the error is now at this line

mysql_query($sql) with mysql_query($sql,$db);
hexkid
pollux1er wrote:
this is the code:
[...]

Did you copy/paste the code or typed it directly?
Please copy/paste the code so that we are not trying to solve errors that appeared or went away when you retyped the code.
I see nothing wrong with your code.

pollux1er wrote:
please hel me to know where is the mistake.
The eror reurned is this:

Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING


The error returned contained a line number, did it not?
Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in phpfile on line ##
So delete that line from your source ( Smile ) and see if the error goes away.
pollux1er
ok i'll try it and tehen i'll tell you the result!
Related topics
Beautiful personal web page!
Which is the best content management software
importing data from phpbb to smf
A very good PHP MySQL Tutorial
insert data to mySQL database problem
Simple Question
Displaying .txt file on web page
a script to modify data through a web page with php
Data Mining From tables and then insert into MySQL
cannot add data to mysql from PHP form
An interesting web page?!
Insert ads into webplayer, which way do you like?
Exe to web page
Fractals: Using them in a web page. I just finished.
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.