Insert data into mysql table

From: Date: Sun, 06 May 2001 12:47:19 +0000
Subject: Insert data into mysql table
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-51610@lists.php.net to get a copy of this message
Hello all, I have created a dabase with table news. I need to add some news into the table via a form. I created two files, the form and the action php file: But I am still unable to add data into the table. Look at my code: ###################addnewsform.php################################### <html dir="rtl"> <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-1256"> <meta http-equiv="Content-Language" content="ar-sa"> <title>Add news</title> </head> <body> ÃÏÎá ÇáãÚáæãÇÊ Ëã ÇÖÛØ Úáì ÃÖÝ: <br> <form method="POST" action="addnews.php"> <div align="center"> <center> <table border=0 width=100% cellspacing=0 cellpadding=0> <tr> <td width=18% bgcolor=#CC99FF valign=top><u>ÚäæÇä ÇáÎÈÑ:</u></td> <td width="82%" bgcolor="#CCCCFF"><textarea rows="2" name="title" cols="40"></textarea></td> </tr> <tr> <td width="18%" bgcolor="#CC99FF" valign="top"><u>ÇáÎÈÑ:</u></td> <td width="82%" bgcolor="#CCCCFF"><textarea rows="10" name="news_body" cols="40"></textarea></td> </tr> <tr> <td width="18%" bgcolor="#CC99FF" valign="top"><u>ÚäæÇä ÇáÊÝÇÕíá:</u></td> <td width="82%" bgcolor="#CCCCFF"><input type="text" name="more_url" size="40"></td> </tr> <tr> <td width="18%" bgcolor="#CC99FF" valign="top">&nbsp;</td> <td width="82%" bgcolor="#CCCCFF"> <div align="center"> <table border="0" width="80%" align="right" cellspacing="0" cellpadding="0"> <tr> <td width="50%"><input type="submit" value="ÃÖÝ" name="B1"></td> <td width="50%"><input type="reset" value="ãÓÍ" name="s2"></td> </tr> </table> </div> &nbsp;</td> </tr> </table> </center> </div> </form> </body> </html> ##########################adnews.php###################################### <? $verbindung=@mysql_connect("localhost", "root", "secret"); $abfrage="INSERT maurimedia(title, news_body, more_url) VALUES ($title, $news_body, $more_url)"; $ergebnis=mysql_db_query("maurimedia", $abfrage, $verbindung); //*Ueberpruefung der Verbindung if (!$verbindung) {echo "impossible de se connecter au db maurimedia"; exit; } //*Ueberpruefung, ob die Daten angekommen sind if ($ergebnis){echo "News successfull added :)";}else {echo "no news added :(";} mysql_close($verbindung); ?> _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com

« previous php.general (#51610) next »