|
Posted by Paul Lautman on 11/24/06 18:54
sahm wrote:
> Hi evry one
> I need some help with my code
> What's wrong in this code
>
> <?php
>
>
> header('Content-Type: text/xml');
> $dom = new DOMDocument();
> $response = $dom->createElement('response');
> $dom->appendChild($response);
>
>
> $sub_categorys = $dom->createElement('sub_Categorys');
> $response->appendChild($sub_categorys);
>
>
> $conn = mysql_connect("localhost", "", "");
> if (!$conn)
> {
> echo "Unable to connect to DB: " . mysql_error();
> exit;
>
>
> }
>
>
> else
> {
> $select = mysql_select_db("yayemen", $conn);
> if (!$select)
> {
> echo "Unable to select mydbname: " . mysql_error();
> exit;
> }
> else
> {
> $sql = "SELECT * FROM sub_category";
> $result = mysql_query($sql, $conn);
> }
>
>
> }
>
>
> while ($row = mysql_fetch_assoc($result))
> {
>
> $cat_NO = $dom->createElement('cat_NO');
> $st1 = $row["sub_cat_ID"];
> $cat_NO_Text = $dom->createTextNode($st1);
> $cat_NO->appendChild($cat_NO_Text);
>
>
> $cat_Name = $dom->createElement('cat_Name');
> $st2 = $row["sub_cat_Name"];
> $cat_Name_Text = $dom->createTextNode($st2);
> $cat_Name->appendChild($cat_Name_Text);
>
>
> $sub_category = $dom->createElement('sub_category');
> $sub_category->appendChild($cat_NO);
> $sub_category->appendChild($cat_Name);
>
>
> $sub_categorys->appendChild($sub_category);
>
>
> $xmlString .= $dom->saveXML();
>
>
>
> }
>
>
> echo $xmlString;
>
>>
>
>
> please help please
Can you tell us what error you're seeing, that'll save us having to first
look for syntax errors, then look for logic errors, then try to guess at
whatthe data may do to it, then .....
[Back to original message]
|