if sql table ENTERY exist olny Update else insert - how to do this
Hello,
i get here very usefull help. Now i get a new Problem. Frist i wanna say that i am a beginner in this scripting language. Problem: now the server olny update the enterys if the server is already in the Table (i added it manual) (See picture 1). The Updateing function works perfecly thanks pRED* | NZ he helpt me very very mutch. http://www.schubinator.de/scriptingh...rtproblem1.jpg Now i olny need a if function and here is the problem. I tried many thinks but i get everytime the error must be indexed or someting else. Maybe somebody knows how this if funktion have to look like. here is my idear, but i am unable to comlile it...(compile errors) I am sure thats there exist a easyer way to make ti work. My try: (as ID i use the Server IP because its never Change): Code:
public write() { If a new server is installing my plugin, its automatical should added in my sql Database, is this done it should update his informations every 15 seconds |
Re: if sql table ENTERY exist olny Update else insert - how to do this
I've never done DBI (only SQLx) so I'm not entirely sure but..
When you run the UPDATE query it should return an error code. There will be a specific code that only happens when the query failed but the connection worked (eg That line in the table doesn't exist). http://www.amxmodx.org/funcwiki.php?go=func&id=210 Using that you should be able to get a return value from dbi_query so you want something like this (might need testing, it's just a guess) Code:
If that doesn't work try if num==0 instead |
Re: if sql table ENTERY exist olny Update else insert - how to do this
Thanks, i will try it today or tomorow (work) i will give feedback if it works, thank u 4 ur help anyway very very mutch
|
| All times are GMT -4. The time now is 10:42. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.