471,886 Members | 1,168 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,886 software developers and data experts.

Anyone See An Error?

Hi,

I'm an old guy trying to create a guestbook. The xml code keeps throwing an error in the following:

Expand|Select|Wrap|Line Numbers
  1. <?xml version="1.0" encoding="utf-8" ?> 
  2. <configuration>
  3.     <img_back>img/back.jpg</img_back>
  4.     <phpURL>/home/users/web/b2713/jpg.jimmybryantnet</phpURL>
  5.     <alert_color>#FF0000</alert_color>
  6.     <name_color>#8d2405</name_color>
  7.     <message_color>#532b2b</message_color>
  8.     <datePosted_color>#307a03</datePosted_color>
  9.     <insert_ok><![CDATA[<font color='#0f5711'>Thanks for the message.</font>]]></insert_ok>
  10.     <insert_error><![CDATA[<font color='#ff0000'>Error adding Message</font>]]></insert_error>
  11. </configuration>
It throws the error: "Error Adding Message", which I assume means that it got that far.

Any help appreciated!

Jimmy
Nov 24 '14 #1
6 3139
!NoItAll
297 100+
The xml is fine. The error is being thrown by something other than the XML parser so we would need to see the rest of your code to determine what might be happening.
Nov 25 '14 #2
I attached all the files - there isn't a lot, but I'm sure you can see the problem. Thank you so much for replying!

Jimmy
Nov 25 '14 #3
!NoItAll
297 100+
I don't see any attachment...
Nov 28 '14 #4
I think the error is in the Guestbook.php module:

Expand|Select|Wrap|Line Numbers
  1. <?php
  2. // CONNECT TO THE SERVER AND SELECT DATABASE
  3. $server = "<?php 
  4. $link = mysqli_connect('jimmybryantnet.ipagemysqli.com', 'jimmyb29', 'alfiep69'); 
  5. if (!$link) { 
  6.     die('Could not connect: ' . mysqli_error()); 
  7.  
  8. echo 'Connected successfully'; 
  9. mysqli_select_db(guestbook); 
  10. ?> ";
  11. $user = "jimmyb29";
  12. $password = "alfiep69";
  13. $dataBase = "guestbook";
  14.  
  15. $conx = mysqli_connect($server,$user,$password);
  16. $db_selected = mysqli_select_db($dataBase,$conx);
  17.  
  18. if($conx && $db_selected){
  19.     // IF CONNECTION IS ESTABLISHED
  20.     $xml = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n";
  21.     $xml .= "<data>\n";
  22.  
  23.     if(isset($_POST['name'])){
  24.         $result = 0;
  25.         $name=mysql_escape_string(trim($_POST['name']));
  26.         $email=mysql_escape_string(trim($_POST['email']));
  27.         $message=mysql_escape_string(trim($_POST['message']));
  28.  
  29.         // ADD DATA TO THE TABLE guestbook WHEN THE USER PRESS THE send_btn in FLASH
  30.         $sqli="INSERT INTO guestbook(name,email,message,dateAdded)values('$name','$email','$message',now())";
  31.         $query = mysqli_query($sql,$conx);
  32.         if ($query){
  33.             $result= 1;
  34.             $sqli2 = "SELECT * FROM guestbook ORDER BY id DESC";
  35.             $query2 = mysqli_query($sql2,$conx);
  36.             //WHEN query == true , GET LIST OF MESSAGES  AND PUT THEM AS XML FILE
  37.             while($data = mysqli_fetch_array($query2)){
  38.                 $xml .= "<guest>\n";
  39.                 $xml .= "<name>".$data['name']."</name>\n";
  40.                 $xml .= "<msg><![CDATA[".$data['message']."]]></msg>\n";
  41.                 $xml .= "<sdate>".$data['dateAdded']."</sdate>\n";
  42.                 $xml .= "</guest>\n";
  43.                 }
  44.             }
  45.         else{
  46.             $result=0;
  47.             }
  48.         $xml .= "<inserted>".$result."</inserted>\n";
  49.  
  50.     }    
  51.     if(isset($_POST['getMessage'])){
  52.             // GET LIST OF MESSAGES AND PUT THEM AS XML FILE
  53.             $sql = "SELECT * FROM guestbook ORDER BY id DESC";
  54.             $query = mysqli_query($sqli,$conx);
  55.             while($data = mysql_fetch_array($query))
  56.                 $xml .= "<guest>\n";
  57.                 $xml .= "<name>".$data['name']."</name>\n";
  58.                 $xml .= "<msg><![CDATA[".$data['message']."]]></msg>\n";
  59.                 $xml .= "<sdate>".$data['dateAdded']."</sdate>\n";
  60.                 $xml .= "</guest>\n";
  61.             }
  62.         }
  63.     $xml .= "</data>\n";
  64.     echo $xml;
  65. }
  66. else{
  67.     // IF CONNECTION == false OR DATABASE DOESN'T EXISTE
  68.     die (mysqli_error());
  69. }
  70. ?>
  71.  
Thanks again for your expertise,

jimmyb
Nov 28 '14 #5
OOPS! I used the wrong terminology - I didn't "attach" the files, I "included" the files in my reply. SORRY!

Jimmyb
Nov 28 '14 #6
Sorry about the
Expand|Select|Wrap|Line Numbers
error - I'm NOT a coder, as you can probably imagine.
Nov 28 '14 #7

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

5 posts views Thread by Bob Bamberg | last post: by
3 posts views Thread by shifty shaker | last post: by
reply views Thread by YellowAndGreen | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.