You are here: Re: help me « PHP Programming Language « IT news, forums, messages
Re: help me

Posted by Christo on 11/15/06 01:25

I thought that

print $sqlquery was the same thing, I can see the query string in one
case it looks like this

INSERT INTO tnews (id, Title, Body, Date) VALUES
('null','12345678ppp','ppp87654321','Wed, 15 Nov 2006 01:20:01 +0000')

the reason its longer is a friend suggested i try doing the query like
that

one thing is though if i do this

INSERT INTO tnews (id, Title, Body, Date) VALUES
('45','12345678ppp','ppp87654321','Wed, 15 Nov 2006 01:20:01 +0000')

and assign 45 where previously the id was blank or null ( i tried both
blank and null)

the above works and the code is almost identical the only difference is
that 45, so anyone got any ideas, my table id field is set as primary
key and auto increment and not null, so why isnt it auto incrementing?

TIA

Chris

Carl wrote:
> Christo wrote:
> > $sqlquery = "INSERT INTO tnews VALUES('$id','$title','$news','$date')";
> >
> > //print "<html><body><center>";
> > //print "<p>You have just entered this record<p>";
> > //print "Title : $title<br><hr>";
> > //print "$news<br>$date";
> > //print "</body></html>";
> >
> > print $sqlquery;
> > $results = mysql_query($sqlquery);
> >
> > mysql_close($dbc);
> >
> > ?>
> >
>
> Christo,
>
> You should always check the value returned by mysql_query() to ensure
> that it did what you think it did. If you find (from the return value)
> that there was a problem, a call to mysql_error() should give you the
> details.
> See the examples here: http://php.net/mysql_query
>
> Also, You should never allow user input ($_POST in your case) to get
> sent directly to the database server. See
> http://www.php.net/mysql_real_escape_string for more info on why and
> how to minimize potential problems.
>
> Hope that helps,
> Carl.

 

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

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