Jump to content

Recommended Posts

i'm trying to get this php file show as xml and... the echo part is not coming up correct. it all comes as one thing instead of 3 attributes

<item review='.$subject.' desc='.$short_description.' img='.$review_img.'/>

 

 

here's teh complete code...

<?php
require_once('cms/config.php');
mysql_select_db($database, $makeconnection);
$sql_get_reviews = "SELECT * 
FROM tbl_reviews 
WHERE review_pending='0'
ORDER BY review_stamp DESC LIMIT 7";
$get_reviews = mysql_query($sql_get_reviews, $makeconnection) or die(mysql_error());
$row_get_reviews = mysql_fetch_assoc($get_reviews);
$totalRows_get_reviews = mysql_num_rows($get_reviews);
echo
'<?xml version="1.0" encoding="UTF-8"?>
<xmlList err="0" str="">';

do {     
$subject = $row_get_reviews['review_shampoo'].' reviewed by '.$row_get_reviews['review_author'];
$description = $row_get_reviews['review_desc'];
$description = str_replace ("&amp","",htmlspecialchars(strip_tags($description))); //clean the description
$short_description = substr($description,5) . "...";
$review_img = $row_get_reviews['review_img'];
;
echo
'
	<item review='.$subject.' desc='.$short_description.' img='.$review_img.'/>
';
}while ($row_get_reviews = mysql_fetch_assoc($get_reviews)); 
mysql_close(); 
echo '</xmlList>';
?>

Link to comment
https://forums.phpfreaks.com/topic/244701-php-as-xml-help-with-echoing/
Share on other sites

I had my quotes all wrong .. fixed it :)) :D

 

<?php
require('cms/config.php');
mysql_select_db($database, $makeconnection);
$sql_get_reviews = "SELECT * 
FROM tbl_reviews 
WHERE review_pending='0'
ORDER BY review_stamp DESC LIMIT 7";
$get_reviews = mysql_query($sql_get_reviews, $makeconnection) or die(mysql_error());
$row_get_reviews = mysql_fetch_assoc($get_reviews);
$totalRows_get_reviews = mysql_num_rows($get_reviews);
echo
'<?xml version="1.0" encoding="UTF-8"?>
<xmlList err="0" str="">';

do {     
$name = $row_get_reviews['review_shampoo'];
$type = $row_get_reviews['review_brand'];
$img = $row_get_reviews['review_img'];
;
echo
'<item review="'.$name.'" desc="'.$type.'" img="'.$img.'"/>';

}while ($row_get_reviews = mysql_fetch_assoc($get_reviews)); 
mysql_close(); 
echo '</xmlList>';
?>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.