anonīms Posted August 18, 2011 Report Share Posted August 18, 2011 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'desc,title,body,created,updated,image,comments) VALUES ('','1', '1'' at line 1 Nu vnk neredzu :X nez nakts vai kas, ceru, ka operatīvi spēsiet palīdzēt. $SQL = "INSERT INTO ".PREFIX."news (language,uid,hot,category,status,desc,title,body,created,updated,image,comments) VALUES ('".$language."','".$lietotajs['id']."', '".$hot."', '".$category."','".$status."', '".$desc."', '".$title."','".$body."', '".time()."','".time()."', '".$image_name.".jpg', '".$comments."')"; print $SQL.'<hr />'; mysql_query($SQL) or die(mysql_error()); Quote Link to comment Share on other sites More sharing options...
anonīms Posted August 18, 2011 Author Report Share Posted August 18, 2011 mļe :// "`" Quote Link to comment Share on other sites More sharing options...
daGrevis Posted August 19, 2011 Report Share Posted August 19, 2011 Nu katrs sīkums un esam jau php.lv/f. :D Quote Link to comment Share on other sites More sharing options...
anonīms Posted August 19, 2011 Author Report Share Posted August 19, 2011 Nē, es tiešām kādu brīdi domāju, skatījos to kodu un vnk nevarēju iebraukt, bet pēc tam, kad te iepostoju, tad pār mani parasti nāk apgaismība un šī nav pirmā un pēdējā reize :D acis ar drusku krita ciet un jā, es labāk paprasu un paralēli meklēju, jo tā sanāk salīdzinoši ātrāk, ja patrs neatrodu izeju :P Quote Link to comment Share on other sites More sharing options...
daGrevis Posted August 19, 2011 Report Share Posted August 19, 2011 Starp citu, Man ar tā bieži ir. Es, piemēram 'staķī', rakstu jautājumu - esmu pusē... un jā! Atbilde jau ir rokā! :D Quote Link to comment Share on other sites More sharing options...
daGrevis Posted August 19, 2011 Report Share Posted August 19, 2011 LOL, iz šodienas: I have line of code that gets count of specified elements in another element. $('.all_posts').find('.post').length Anyway, the problem is that it doesn't change. I guess its because it ignores that I have removed that element after page has been loaded. With jQuery, of... Un tad Es sapratu, ka esmu nevis elementu 'remove', bet gan 'hide'. :D Quote Link to comment Share on other sites More sharing options...
Faks Posted August 19, 2011 Report Share Posted August 19, 2011 kurš liek time() pediņas un tad sūdzas ka ir problēmas :) Quote Link to comment Share on other sites More sharing options...
briedis Posted August 19, 2011 Report Share Posted August 19, 2011 (edited) kurš liek time() pediņas un tad sūdzas ka ir problēmas :) Nav starpības. Šeit problēmas iemesls bija rezervēta vārda DESC lietošana kolonnas nosaukumā. Edited August 19, 2011 by briedis Quote Link to comment Share on other sites More sharing options...
daGrevis Posted August 19, 2011 Report Share Posted August 19, 2011 Pierādījums, ka garāks pieraksts, bieži vien, ir daudz lasāmāks. Izmantots Kohana QB, starp citu. $query = DB::insert(PREFIX . 'news') ->columns(array( 'language', 'uid', 'hot', 'category', 'status', 'desc', 'title', 'body', 'created', 'updated', 'image', 'comments' )) ->values(array( $language, $lietotajs['id'], $hot, $category, $status, $desc, $title, $body, time(), time(), $image_name, '.jpg', $comments )) ->execute(); Quote Link to comment Share on other sites More sharing options...
rATRIJS Posted August 19, 2011 Report Share Posted August 19, 2011 Nu nez, nez - man tas pieraksts izskatās diegan pretīgs :( Quote Link to comment Share on other sites More sharing options...
daGrevis Posted August 20, 2011 Report Share Posted August 20, 2011 Tu nopietni, rATRIJ? Tas nevar buut. :D Quote Link to comment Share on other sites More sharing options...
viena tante Posted August 20, 2011 Report Share Posted August 20, 2011 (edited) daGrevis, Tev tas "kohana" izskan aptuveni katrā 15-20 postā un, ja ņem vērā, ka dienā ražo kādus 20, tad sanāk, ka katru dien vismaz 1 reizi. :D Būtu jau labi, ja vismaz 1/5 daļa no Taviem postiem būtu lietderīgi, ja ņem vērā, ka esi pat moderators vai kas tur :) P.S Rīgas svētki, nedaudz pagulēju, bet tainība jau vien laikam ir Edited August 20, 2011 by viena tante Quote Link to comment Share on other sites More sharing options...
vertex Posted August 20, 2011 Report Share Posted August 20, 2011 Pieraksts ir diezgan līdzīgs mongodb query veidošanai. Quote Link to comment Share on other sites More sharing options...
daGrevis Posted August 20, 2011 Report Share Posted August 20, 2011 MongoDB - arī jauka lieta... un Kohanā ir tāda lieta kā Mango, kas, pēc idejas, ir bind'ings MangoDB. Tante, nelasi manus postus. Man, īstenībā, ir diži vienalga ko kaut kāds pensis domā. :) Visu cieņu! :D Quote Link to comment Share on other sites More sharing options...
xPtv45z Posted August 20, 2011 Report Share Posted August 20, 2011 (edited) Manuprāt, šādi būtu vēl labāk lasāms. Nav jāskaita, kurai kolonai, kura vērtība atbilst. :) $insert = array( 'language' => $language, 'uid' => $lietotajs['id'], 'hot' => $hot, 'category' => $category, 'status' => $status, 'desc' => $desc, 'title' => $title, 'body' => $body, 'created' => time(), 'updated' => time(), 'image' => $image_name.'.jpg', 'comments' => $comments ); $query = DB::insert(PREFIX . 'news') ->columns(array_keys($insert)) ->values(array_values($insert)) ->execute(); Edited August 20, 2011 by xPtv45z Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.