php - Insert multiple image names into same database field, separated by comma -


मेरे पास यह स्क्रिप्ट है:

कई फाइल अपलोड करें - कोड का टुकड़ा

  foreach ($ _FILES ['फाइल'] ['नाम'] $ एफ = & gt; $ name) {if ($ _FILES ['files'] ['त्रुटि'] [$ f] == 0) { } else {// कोई त्रुटि नहीं मिली! अपलोड किए गए फ़ाइलों को ले जाएं $ ext = pathinfo ($ _ फ़ाइलें ['फ़ाइलें'] ['नाम'] [$ f], PATHINFO_EXTENSION); $ Uniq_name = uniqid () '।' । $ Ext; $ Dest = $ पथ $ Uniq_name; // पूर्ण प्रस्थान अगर (move_uploaded_file ($ _ फ़ाइलें ["फ़ाइलें"] ["tmp_name"] [$ f], $ dest)) {$ count ++; }}}   

कृपया मेरे mysql डेटाबेस को सभी फोटो नामों में कैसे सम्मिलित करें, फोटो फ़ील्ड में, अल्पविराम से अलग करें।

जब मैं 2 लाइन कोड लिखना:

  $ a = "अंतर्निहित dbu.dbu_data (photos) मूल्य ('$ uniq_name')"; mysql_query ($ एक);   

आईटी ने इन्हें अपलोड किए गए प्रत्येक फोटो के लिए एक सार पंक्ति का इस्तेमाल किया है और मुझे यह नहीं चाहिए।

  $ delimiter = ","; $ Str = ''; Foreach ($ _FILES ['फ़ाइलें'] ['नाम'] $ एफ = & gt; $ नाम के रूप में) {यदि ($ _FILES ['फ़ाइलें'] ['त्रुटि'] [$ f] == 0) // आपका चाल तर्क यहाँ जाने की जरूरत है} else {// कोई त्रुटि नहीं मिली! अपलोड किए गए फ़ाइलों को ले जाएं $ ext = pathinfo ($ _ फ़ाइलें ['फ़ाइलें'] ['नाम'] [$ f], PATHINFO_EXTENSION); $ Uniq_name = uniqid () '।' । $ Ext; $ Dest = $ पथ $ Uniq_name; // पूर्ण प्रस्थान अगर (move_uploaded_file ($ _ फ़ाइलें ["फ़ाइलें"] ["tmp_name"] [$ f], $ dest)) {$ count ++; अगर (strlen ($ str)) {$ str = $ delimiter; } $ str = $ dest; }}} यदि (strlen ($ str)) {$ a = "dbu.dbu_data (photos) मूल्यों में शामिल करें ('"। Mysql_real_escape_string ($ str) "')"; mysql_query ($ एक); }    

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -