Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Your content variables are indeed empty at the point at which you construct the sql query- they were unset above. </p> <pre><code>$query = mysql_query("INSERT INTO data (div,td,p,b) VALUES \ ('$content1','$content2','$content3','$content4')"); </code></pre> <p>I think you probably want $value's nodeValue content from each of your $content as $value strings to be placed in that mysql query (you can access the textual content of nodes using $value->nodeValue).</p> <p>For example, if you want the textual content of a node such as this P node from your example, which looks like this when you print_r the node:</p> <pre><code>DOMElement Object ( [tagName] =&gt; p [schemaTypeInfo] =&gt; [nodeName] =&gt; p [nodeValue] =&gt; Students should note that all of the modules below may not be available to them. [nodeType] =&gt; 1 [parentNode] =&gt; (object value omitted) [childNodes] =&gt; (object value omitted) [firstChild] =&gt; (object value omitted) [lastChild] =&gt; (object value omitted) [previousSibling] =&gt; (object value omitted) [nextSibling] =&gt; (object value omitted) [attributes] =&gt; (object value omitted) [ownerDocument] =&gt; (object value omitted) [namespaceURI] =&gt; [prefix] =&gt; [localName] =&gt; p [baseURI] =&gt; [textContent] =&gt; Students should note that all of the modules below may \\ not be available to them. ) </code></pre> <p>you can see that there are two values in that node that might be interesting to you - <a href="http://www.w3schools.com/dom/prop_element_textcontent.asp" rel="nofollow">textContent and nodeValue</a>.</p> <p>You can access these from your code by doing this:</p> <pre><code> foreach ($content3 as $value) { // content3 contains the p nodes, I think? // let's see what the node looks like print_r($value); // let's get hold of the text value from the node $mytempvariable=$value-&gt;nodeValue; print "CONTENT OF P NODE: \n\n$mytempvariable\n\n\n"; } </code></pre> <p>This will print out the text from all your P nodes. </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload