You are here: Re: simple adding of data to a table « PHP Programming Language « IT news, forums, messages
Re: simple adding of data to a table

Posted by Michael Fesser on 02/07/07 18:17

..oO(tomhughes_86@hotmail.com)

>and the PHP script to add data:
><?

<?php

>$host="localhost"
>$username="root";

root?! You should create and use a normal user account.

>$database="test";
>
>
>$test2=$_POST['test2'];

Check with isset() if $_POST['test2'] exists.

>mysql_pconnect($host,$username);

mysql_connect(...);

>@mysql_select_db($database) or die( "Unable to select database");
>
>
>$query = "INSERT INTO test2 VALUES ('','$test2')";
>mysql_query($query);

No error handling. What does mysql_query() return? Or mysql_error()?
Is error_reporting set to E_ALL?

Micha

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация