#Major . Posted July 12, 2018 Share Posted July 12, 2018 (edited) ايش هي الطريقة الي اقدر احفظ فيها الجداول بقاعدة بيانات واسترجعها منها فكرت ب tojson & fromjson بس م عرفت لها How ! Edited July 12, 2018 by *RayaN-Alharbi. Link to comment
^iiEcoo'x_) Posted July 13, 2018 Share Posted July 13, 2018 setAccountData ( getAccount ( 'Ra7-TnGLD' ) , 'ExampleJson' , toJSON ( { 'Hhh' , 'hohoho' , 'neahahaha' } ) ) local Data = getAccountData ( getAccount ( 'Ra7-TnGLD' ) , 'ExampleJson' ) if ( fromJSON ( Data ) [ 1 ] == 'Hhh' ) then iprint ( 'yup' ) end Link to comment
#Major . Posted July 13, 2018 Author Share Posted July 13, 2018 5 hours ago, #_iMr,[E]coo said: setAccountData ( getAccount ( 'Ra7-TnGLD' ) , 'ExampleJson' , toJSON ( { 'Hhh' , 'hohoho' , 'neahahaha' } ) ) local Data = getAccountData ( getAccount ( 'Ra7-TnGLD' ) , 'ExampleJson' ) if ( fromJSON ( Data ) [ 1 ] == 'Hhh' ) then iprint ( 'yup' ) end شكرا لكن طريقة حفظ الجداول تختلف Link to comment
#Major . Posted July 13, 2018 Author Share Posted July 13, 2018 52 minutes ago, Abdul KariM said: لا نفس الطريقة خلاص عرفت for _,k in ipairs(Table) do executeSQLQuery ( "INSERT INTO `Save Table System` ( Name,Col 1, Col 2,Col 3 ) VALUES(?,?,?,?)","Table",k[1],k[2],k[3] ) end Link to comment
Abdul KariM Posted July 13, 2018 Share Posted July 13, 2018 ترا كذا بتزيد من مساحة القاعدة خصوصا لو كان التيبل فيه معلومات كثيرة Link to comment
#Major . Posted July 13, 2018 Author Share Posted July 13, 2018 19 minutes ago, Abdul KariM said: ترا كذا بتزيد من مساحة القاعدة خصوصا لو كان التيبل فيه معلومات كثيرة for _,k in ipairs(Table) do executeSQLQuery ( "INSERT INTO `Save Table System` ( Name,Col 1 ) VALUES(?,?,?,?)","Table",toJSON({k[1],k[2],k[3]} ) end وكذا؟ Link to comment
Abdul KariM Posted July 13, 2018 Share Posted July 13, 2018 مافرقت لانك انت مسوي لوب ف لازم تحط تحول الجدول لجسون وتخزنه بالقاعدة Link to comment
#Major . Posted July 13, 2018 Author Share Posted July 13, 2018 4 minutes ago, Abdul KariM said: مافرقت لانك انت مسوي لوب ف لازم تحط تحول الجدول لجسون وتخزنه بالقاعدة والله م فهمت طريقتك ياليت تشرح لي :\ ؟ Link to comment
Abdul KariM Posted July 13, 2018 Share Posted July 13, 2018 (edited) theTable = { } executeSQLQuery ( "INSERT INTO `Table_System` ( myTable ) VALUES(?)", toJSON ( theTable ) ) function getTableFromSql ( ) local aRow = executeSQLQuery( "SELECT myTable FROM `Table_System`" ) if ( type ( aRow ) == "table" and #aRow == 0 ) or not aRow then return end return fromJSON ( aRow [ 1 ] [ "myTable" ] ) end ذا شي بسيط وانت طبق على الي عندك Edited July 13, 2018 by Abdul KariM Link to comment
#Major . Posted July 13, 2018 Author Share Posted July 13, 2018 5 hours ago, Abdul KariM said: theTable = { } executeSQLQuery ( "INSERT INTO `Table_System` ( myTable ) VALUES(?)", toJSON ( theTable ) ) function getTableFromSql ( ) local aRow = executeSQLQuery( "SELECT myTable FROM `Table_System`" ) if ( type ( aRow ) == "table" and #aRow == 0 ) or not aRow then return end return fromJSON ( aRow [ 1 ] [ "myTable" ] ) end ذا شي بسيط وانت طبق على الي عندك شكرا Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now