Jump to content

trying to get a literal string value from a variable


fotobleu

Recommended Posts

im trying to get data from a certain cell in the row

 

this is what i have so far

 

<code>

$chosenPath = 'fotos_thumbpath'; //default

if($thumbSize == 'S')
{
	$chosenPath = 'thumbpath';
}
else if($thumbSize == 'M')
{
	$chosenPath = 'thumbforsale';
}
else if($thumbSize == 'L')
{
	$chosenPath = 'fotopath';
}

echo $row[$chosenPath];

</code>

 

on the echo statement nothing gets displayed, i checked the db and there is data in those rows, i think it has something to do with

the $chosePath variable, any ideas?

 

thanks in advance

 

regards

 

-daniel

Link to comment
Share on other sites

here is the whole code

$result = $dbObj->Query("select fotos_title, fotos_pnr, fotos_thumbpath, fotos_date from fotoblog_fotos order by fotos_date desc limit ".$settingsRow['config_rssAtomCount'].";");


//find out which thumbnail selected to generate
$thumbSize = $settingsRow['config_rssAtomThumbSize'];



$chosenPath = 'fotos_thumbpath'; //default

if($thumbSize == 'S')
{
	$chosenPath = 'fotos_thumbpath';
}
else if($thumbSize == 'M')
{
	$chosenPath = 'fotos_thumbforsale';
}
else if($thumbSize == 'L')
{
	$chosenPath = 'fotos_fotopath';
}

///echo $row[$chosenPath];

if(mysqli_num_rows($result) > 0)
    {
	while ($row = mysqli_fetch_assoc($result)) 
	{

		//$pathToRSSThumb = fixFotoPath($row[$chosenPath]);
		$pathToRSSThumb = $row[$chosenPath];
		//echo "rss thumb path ".$pathToRSSThumb.'<br/>';
		$echoStr .= '<item>
			         <title>'.$row[fotos_title].'</title>
			         <link>'.$headCode.$dname.'?pnr='.$row[fotos_pnr].'</link>
			         <description>
							<img src="'.$headCode.$dname.'/'.$pathToRSSThumb.'">

							<br />
					 </description>
			         <pubDate>'.date('c',strtotime($row[fotos_date])).'</pubDate>
			         </item>';
	}
}

$echoStr .= '</channel></rss>';
echo $echoStr;

Link to comment
Share on other sites

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.