First off, you should just connect to the database once (probably at
boot time) and leave the connection open all the time.

> The problem with this, is that the if statement I have here, returns -1 as
> it's value. I don't know what I'm doing wrong here. I've also tried 

There's like 6 if statements in there.. please be more specific :)

>   if (!mysql_init(&MySQLConn)) {

Shouldn't worry about the return value of mysql_init unless you're
expecting it to dynamically allocate the memory (passing it a NULL).

>   if (mysql_real_query(&MySQLHelpConn, sql, strlen(sql)) != 0)  {

If everything else works, and this is where it's failing, then there is
probably an error in your sql.  Print out the sql that it uses to query
and make sure it works from within the mysql client.
It *looks* right, without knowing how your database is set up.
Next, check the mysql documentation for the possible errors that the
function can generate.  Each return value means something different.
Finally, make sure that you have select permissions for the database you
created.
Try setting the host variously as "localhost", "127.0.0.1", and the
server's IP (assuming the DB is on the same server).  Sometimes mysql
permissions exclude strange things.

--Palrich.

Reply via email to