1. Euphoria and MySql
I was previously using Euphoria quite a bit. But, for awhile now, I have
concentrated on PHP and so I am afraid I may have forgotten some of the tiny
things that make Euphoria work.
I am trying to use the EMySqLib wrapper for MySql with Euphoria.
I have been able to create a database and a table. However, I have run into
some problems inserting data into the table.
I have a feeling that the problem is more of a syntax error with Euphoria,
instead of a MySql problem.
The reason is because I can get the exact same thing to work in PHP AND..it
works in Euphoria if I don't try to insert variable data for the mysql data.
Here's the example:
global function RunQuery(object query)
object result
integer dbid
dbid=OpenDBConnection()
result = mysql_select_db({"kituwah"})
result = mysql_query({query})
CloseDBConnection(dbid)
return result
end function
thetabletype="characters"
query="INSERT INTO characters (type,whereat,online) VALUES
(thetabletype,'getName',3)"
ConsoleMsg("creating a new character now....")
result=RunQuery(query)
The problem is not in the RunQuery function, because it works correctly in
creating a table, etc.
Also, if i delete the "type" from the fieldlist and delete the "thetabletype"
from the values list,
this works. So, I think I have some sort of syntax problem, that I've forgotten
while working with
PHP. Can anyone help me figure out how to send variable data in a mysql query,
using Euphoria?
2. Re: Euphoria and MySql
Michelle wrote:
>
>
> I was previously using Euphoria quite a bit. But, for awhile now, I have
> concentrated
> on PHP and so I am afraid I may have forgotten some of the tiny things that
> make Euphoria work.
>
> I am trying to use the EMySqLib wrapper for MySql with Euphoria.
>
> I have been able to create a database and a table. However, I have run into
> some problems inserting data into the table.
> I have a feeling that the problem is more of a syntax error with Euphoria,
> instead
> of a MySql problem.
>
> The reason is because I can get the exact same thing to work in PHP AND..it
> works in Euphoria if I don't try to insert variable data for the mysql data.
>
> Here's the example:
>
> }}}
<eucode>
>
> global function RunQuery(object query)
> object result
> integer dbid
>
> dbid=OpenDBConnection()
> result = mysql_select_db({"kituwah"})
> result = mysql_query({query})
> CloseDBConnection(dbid)
>
> return result
> end function
>
> thetabletype="characters"
>
> query="INSERT INTO characters (type,whereat,online) VALUES
> (thetabletype,'getName',3)"
>
> ConsoleMsg("creating a new character now....")
> result=RunQuery(query)
>
> </eucode>
{{{
>
>
> The problem is not in the RunQuery function, because it works correctly in
> creating
> a table, etc.
> Also, if i delete the "type" from the fieldlist and delete the "thetabletype"
> from the values list,
> this works. So, I think I have some sort of syntax problem, that I've
> forgotten
> while working with
> PHP. Can anyone help me figure out how to send variable data in a mysql
> query,
> using Euphoria?
bah..i fixed my own problem...
but if anyone else ever needs similiar help..I fixed it like this:
thetabletype="characters"
query="INSERT INTO characters (type,whereat,online) VALUES ('"
query=query&thetabletype
query=query&"','getName',3)"
ConsoleMsg("creating a new character now....")
result=RunQuery(query)
*kicks herself*
sorry, i knew it was a stupid mistake, i just couldn't get back in Euphoria-mode
enough to figure it out.