Help with the new dbi...
Why does this code:
Code:
public dbseinit() {Quote:
|
Because you have a bracket or something missing above this function. Its not the DB. Please post the whole .sma
Cheers! |
oh :oops: i dont rely see it :(
Code:
|
You need to take a few steps back here.
Firstly, go and look at some well-indented code. Your code lacks good indentation, it will give you troubles, just like you have troubles now. Indentation is worthless for the compiler, but not worhtless for you and me, which means in the end we will write crappy code if we can't see what we're doing. And that is something the compiler eventually will bug us about. Secondly, when creating a db connection that you intend to use throughout the rest of the plugin, you should save that db handle - which you aren't doing here because the db handle you get when you create the connection in dbseinit is only stored locally in the variable dbiSqL. I can see that you try to access "the same" variable in other functions, but as they aren't defined anywhere in the scopes of those functions, you won't either be able to reach them. A solution: define dbiSql globally. It would make sense. Probably you intended to do this all the time (just agree now ;-)). The small compiler is far from even good: the problem here was not that dbiSqL was defined at an earlier level: it was not created at all... I don't really know why the compiler does this, but it sure looks like a bug in the compiler to me. |
Ok here is a good copy of the file. I only get one warning and I dont know why. Now I would pay attention to the coding style, its using a convention and one that you should use. Its not the only one but its one that is EASY to read. Your code was very difficult and hard to comprehend. It took about 1/2 an hour just to decifer. But as JGHG has stated you should learn to use a convention of some such:
Code:
Cheers! And Luck. |
yea, instead of using the code tags
use the Code:
|
I realy love you, you didnt have to make it so good indented, i was going to fix that anyway, and to you Johnny got his gun, I agree with the things you wanted me to agree to, and i agree that it was stupid of me tho come and ask for help with that "ugly" code :(
zor, you must have bean realy bored this day? Edit: You shouldnt have return PLUGIN_CONTINUE in the modules part, or atleast you doesnt need it, may that have created the error? Edit: new aid = dbi_field(dbiSqL, 1) This gives me a tag missmatch error, can someone explain whats wrong? |
Ok. Just figured it out. Ok:
Code:
The way you had it you were passing the SQL reference to it not the RESULT. I fixed it here. I also changed it to dbi_result instead of dbi_field this is better I think. That way you are referencing the exact variable. Cheers! |
:O, Before i was using !mysq_nextrow to check if there was any errors, i guess thats what moved it forward there :)
thanks a lot |
| All times are GMT -4. The time now is 17:21. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.