← 返回内容列表

Problem with: Fatal error: [] operator not supported for strings in Ask Question

Problem with: Fatal error: [] operator not supported for strings in Ask Question

I\'m getting information from database, saving it in array and echoing it in a form with loop structure and I\'m having problems when I try to save the modified information to database. I\'m getting this error: Fatal error: [] operator not supported for strings in....

<p>You get this error when attempting to use the short array push syntax on a string.</p> <p>For example, this</p> <pre> <code>foo = &#39;foo&#39;;foo[] = &#39;bar&#39;; // ERROR!</code></pre> <p>I&#39;d hazard a guess that one or more of your&nbsp;<code>name</code>,&nbsp;<code>date</code>,&nbsp;<code>text</code>&nbsp;or&nbsp;<code>date2</code>&nbsp;variables has been initialised as a string.</p> <p><strong>Edit:</strong>&nbsp;Looking again at your question, it looks like you don&#39;t actually want to use them as arrays as you&#39;re treating them as strings further down.</p> <p>If so, change your assignments to</p> <pre> <code>name=name =row[&#39;name&#39;]; date=date =row[&#39;date&#39;]; text=text =row[&#39;text&#39;]; date2=date2 =row[&#39;date2&#39;];</code></pre>

评论 (0)

加载评论中…