You are here: Re: I get a syntax error when trying to learn code in a quick start guide. « PHP SQL « IT news, forums, messages
Re: I get a syntax error when trying to learn code in a quick start guide.

Posted by Serge Terryn on 12/14/06 08:25

cerberus schreef:
> Rik wrote:
>> cerberus wrote:
>>> I'm totally new to PHP and MySQL. I'm using a quick start guide to
>>> make a little blog. I get:
>>>
>>> "You have an error in your SQL syntax; check the manual that
>>> corresponds to your MySQL server version for the right syntax to use
>>> near 'LIMIT 1' at line 1. The query was DELETE FROM blog_entries WHERE
>>> blog_id= LIMIT 1."
>> There should be an extra check wther $_POST['id'] is set. It isn't, or
>> results in null in strings, so the result (the query as you mentioned
>> above) is invalid.
>> --
>> Rik Wasmus
>
> Thanks Rik. But that brings the next prob. I'm really new to this
> stuff. This is the first set of PHP script I've ever written.
>
> What is the best method for checking the $_POST? In the first if
> statement, or an entirely new if statement. Just curious, I'm a total
> noob.
>
> Thanks for your help.
>
> Ian
>

if(isset($_POST['var'])) {

}
else {

}


And this will not work:

DELETE FROM blog_entries WHERE blog_id=LIMIT 1

It should be something as :

DELETE FROM blog_entries WHERE blog_id='$var' LIMIT 1


--
Essetee ---- Roeselare ---- Belgium
http://www.essetee.be
ICQ : 763290 -- Jabber : essetee@jabber.org

 

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

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