Re: Getting domdocument::domdocument() expects parameter 2 to be long

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

try the following code.It has been tested successfully.

<?php
// Connect to the database server.Use your own Databae & table,As well as //servername,password.
$link = mysql_connect('localhost', 'root', '12345');
if (!$link) {
 exit('<p>Unable to connect to the ' .
     'database server at this time.</p>');
}

// Select the test database
if (!mysql_select_db('test')) {
 exit('<p>Unable to locate the  ' .
     'database at this time.</p>');
}

// Request the text of all the records
$result = mysql_query("SELECT * FROM biodata");
if (!$result) {
 exit('<p>Error performing query: ' . mysql_error() . '</p>');
}

// Display records
echo "<table border=1 bgcolor='yellow'>\n";
for ($i=0;$i < mysql_num_fields($result);$i++) {
echo("<th>" .mysql_field_name($result,$i) ."</th>");
}
while ($line = mysql_fetch_array($result,MYSQL_ASSOC)) {
 echo  "\t<tr>\n" ;
foreach($line as $col_value) {
echo "\t\t<td>$col_value</td>\n";
}
  echo "\t</tr>\n";
}
echo "</table>\n";
//$dom = new DOMDocument('1.0', 'iso-8859-1');
//$doc=new DomDocument( '1.0','UTF- 8');
$dom = new DOMDocument('1.0', 'iso-8859-1');

//$element = $dom->createElement('abc', 'This is the root element!');

// We insert the new element as root (child of the document)
//$dom->appendChild($element);

//echo $dom->saveXML();


mysql_free_result($result);
mysql_close($link);
//$doc=new DomDocument('1.0','UFT-8');
?> 
with regards.
Abdul Qadir.


            



       
---------------------------------
Be a better friend, newshound, and know-it-all with Yahoo! Mobile.  Try it now.

[Non-text portions of this message have been removed]


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux