You are here: Re: Not able to add data to a MySQL database « PHP « IT news, forums, messages
Re: Not able to add data to a MySQL database

Posted by M. Sokolewicz on 09/29/57 11:09

You've got errors in your SQL.
For once, table-names should not be quoted (with single or double
quotes), same goes for column names ('uname' and 'access' in your example).

Easiest way to find out without asking is to add a call to
mysql_error(), so called "error handling"...! That would've told you
about the syntax errors. Fix those, and it should work just fine

- tul

Vaibhav Sibal wrote:

> Hi,
> I am not able to insert data into my mysql database using php even if
> i use a simple code as follows :
> <?php
> $link=mysql_connect("localhost","username","password");
> mysql_select_db("test_db");
> $query="INSERT INTO 'login' ('uname','access') VALUES ('try','super')";
> mysql_query($query,$link);
> ?>
>
> even after running this code on the server, there was no change in the
> mysql database as seen by the phpmyadmin. Ive tried it with another
> file and another table, but its not just happening. Though earlier
> attempts with Mysql had worked, but those only involved reading data
> from the database and I havent been able to write to it even once
> since I have started working. Please help me out with this, in case
> there is some information that I should have provided here and its not
> there please ask for it, I will be more than happy to provide it.
>
> Thanks
> Vaibhav

 

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

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