Reply to Re: PHP and SQLIte: UPDATE statement fails

Your name:

Reply:


Posted by Jerry Stuckle on 11/22/07 13:29

Luigi wrote:
> Hello all!
>
> I'm a newbie in PHP. I have written a short script that tries to
> update a SQLite database with the user data. It is pretty simple,
> something like this:
>
> <?php
>
> $sqlite = sqlite_open("mytest.db", 0666, $sqlite_error);
>
> if(!$sqlite) {
> die("Sqlite error: ".$sqlite_error);
> }
>
> $statement = "update myusers set mail=\"mymail\" where name=\"myuser
> \"";
> sqlite_query($sqlite, $statement);
> sqlite_close($sqlite);
>
> ?>
>
> It's just a test, but it doesn't work. It doesn't give me any error,
> but the table is not updated. Can you suggest me a possible reason?
>
> Thanks.
>

Luigi,

I don't use SQL Lite (I'm a MySQL fan, myself). But standard SQL uses
single quotes (') around string constants, not double quotes.

In your query, add a third variable to get any returned error code (as
in your sqlite_open() statement). If your sqlite_query() fails, print
the message in your error string.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

[Back to original 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

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