Raised This Month: $ Target: $400
 0% 

SQL Selecting a Row?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
danielkza
AMX Mod X Plugin Approver
Join Date: May 2007
Location: São Paulo - Brasil
Old 12-27-2008 , 03:19   Re: SQL Selecting a Row?
Reply With Quote #2

Quote:
Originally Posted by Drak View Post
Okay, so, I have this.
Code:
&nbsp;&nbsp;&nbsp;&nbsp;while(SQL_MoreResults(Query)) &nbsp;&nbsp;&nbsp;&nbsp;{ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;SQL_ReadResult(Query,0,Origin[0]); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;SQL_ReadResult(Query,1,Origin[1]); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;SQL_ReadResult(Query,2,Origin[2]); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;new Floatistance = get_distance_f(Origin,EntOrigin); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;if(Distance <= 37.0) &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;{ // RIGHT HERE I WANT TO DELETE THIS ROW &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;} SQL_NextRow(Query); } }

Reading the comment, is it possable to get what row it's reading? So i can delete it. SQL_NextRow doesn't return a value, so I have no idea.
Best way to do this is to add a PRIMARY KEY column for the table, normally using AUTO_INCREMENT, that should represent each row with an unique number. Then you can read it and do 'DELETE FROM table WHERE id=%d LIMIT 1'.
__________________

Community / No support through PM
danielkza is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 09:18.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode