Author | Message | Time |
---|---|---|
Final | Ok well Its been a couple of hours and I cant seem to find any good tutorials on using mysql.h By itself I tried all the wrappers they always have a damn error so I dont deal with them. Ive been trying to gather data from mysql server with just mysql.h and I cant seem to output data. this is what i have so far. [code] MYSQL* mysql = mysql_init(NULL); MYSQL_RES* _result; MYSQL_ROW _curr_row; MYSQL* _handle; int index=0; char sx[MAX_PATH]; mysql_real_connect(mysql,"127.0.0.1","root","blah","Main",PORT,0,1); mysql_query(mysql,"SELECT * FROM members WHERE username=`unkownname`"); _curr_row = mysql_fetch_row(_result); char* data = _curr_row[1]; [/code] what should i do next to do this right cuz it always crashes when it gets here char* data = _curr_row[1]; ?? I really really need help on this. | April 17, 2006, 12:55 AM |
warz | What's the error? And does mysql_real_connect open the table and database and everything? | April 17, 2006, 2:18 AM |
Final | sorry everyone after taking 6 hours of my life I figured it out blindy I made contact got my first variable back and never been happier if anyone need source on how to do it ask me. //Got another problem with mysql and c++ though// I have been making a server in c++ for the past few months that wy I needed mysql. Now that i have it working I have the data outputed like this. Row[0]= ID Row[1]= Username Row[2]= Password And i have a packet buffer reading authentication from client side. So i Parse like so Switch(buffer[1]){ //All buffer code goes here// } But Im having a problem I get my packet information like so. char* username=buffer+4; char* password=buffer+sizeof(username)+5; what Im having problems is, When i try doing an if() on it to check if passwords match like so. if(password==Row[2]){ //I Add A success// }else{ //I Denied// } But for somereason Everything is correct password= Blah and Row[2]= Blah But It dont Accept it for $hit could someone tell me wy. | April 17, 2006, 5:24 AM |
warz | well, it shouldn't let you compile like that. you'll need to look up the functions strncmp or strcmp on msdn and use either one | April 17, 2006, 8:25 AM |
Kp | [quote author=warz link=topic=14786.msg150714#msg150714 date=1145262306] well, it shouldn't let you compile like that. you'll need to look up the functions strncmp or strcmp on msdn and use either one [/quote] Why not? His grammar is atrocious, but his code looks syntactically valid. It's wrong for what he wants it do to, but it's syntactically OK. | April 18, 2006, 2:04 AM |
Final | Well Thanks for Ciritsm and flatter my code. Hmm So now I see I have something wrong by what you guys say so what should id do to do right cuz what i did Did get the values of my mysql database but couldnt compare. --Sorry for last part of that Let me try out that function; Update Sorry To bother but could i get an example from you guys simple one because the freaking stuff websites are giving me are farely wierd if it is less than equal to 0 or less than wtf ? im having trouble. | April 18, 2006, 4:03 AM |
Kp | For a self-proclaimed decent programmer, you don't seem very good. Your spelling shows what I hope is merely a lack of care, and your punctuation's no better. A decent programmer would've tried stepping through in a debugger to analyze what's failing. I'd offer you some help out of pity, but I don't see the point wading through your post to try to find the question, if one is even articulated well enough to be answered. | April 18, 2006, 4:19 AM |
Final | Sorry I was reading up on wrong function it was second strcmp sorry about that kp | April 18, 2006, 4:33 AM |
TheMinistered | [quote] For a self-proclaimed decent programmer, you don't seem very good. Your spelling shows what I hope is merely a lack of care, and your punctuation's no better. A decent programmer would've tried stepping through in a debugger to analyze what's failing. I'd offer you some help out of pity, but I don't see the point wading through your post to try to find the question, if one is even articulated well enough to be answered. [/quote] I love the enthusiasm there... I mean really... I gotta lol for a min... OK Like do you really think that helps guy? I mean guy probably is fairly new and maybe a bit cocky... but why not send him down the road of wisdom instead of insulting him kp, you yellow belly turd ^^. EDIT: You ever consider maybe he is using the english version of the IDE and perhaps this guy is hispanic, asian (invasion), russian, german, deutch, etc??? Maybe he is a beginner non-caucasian programmer-- perhaps his skills in assembly are more elite than you, he would be a great honor to have here at VALHALLA LEGENDS. | April 19, 2006, 4:18 PM |
Final | well thanks for compliment and im Hispanic but I use english more than spanish I know how to speak english very well its just my spelling sucks sorry if that bothers anyone here I always get some comment on that. Like Stealthbot everyone got mad at my spelling and didnt pay attention to my problem I felt really down but yet again someone goes and does it again stealthbot dosent do it anymore but its like , were ever i go ill always be insulted. | April 19, 2006, 4:25 PM |