You are here: Re: Creating Stored Procedure from PHP « PHP SQL « IT news, forums, messages
Re: Creating Stored Procedure from PHP

Posted by Jim Michaels on 02/23/06 01:51

"Tim Mickelson" <tim_mickelson@hotmail.com> wrote in message
news:th4zf.35560$av6.8679@tornado.fastwebnet.it...
> Hello everyone, I resolved it myself in the end, from the documentation of
> mysql_query:
> "The query string should not end with a semicolon"
> I never knew this, so I have always ended my queries with a semicolon,
> knowing this, it was sufficiento to do:
>
> <?
> $con = mysql_connect('localhost','pippo','pluto');
> mysql_select_db('test');
>
> // THIS WORKS :-)
> $query.= "CREATE PROCEDURE test.users(name VARCHAR(30)) ";
> $query.= "BEGIN";
> $query.= "DECLARE comment VARCHAR(100);";
> $query.= "SET comment = CONCAT(name,' is added');";
> $query.= "INSERT INTO users (id,name,comment) VALUES
> (NULL,name,comment);";
> $query.= "END";
>
> mysql_query($query);
> mysql_close($con);
> ?>

You are forgetting Aho's point. you are concatenating strings without
whitespace between them. so you end up with BEGINDECLARE as one word.
you could at least put a \n on those lines or a space.

 

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

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