fotobleu Posted December 4, 2007 Share Posted December 4, 2007 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 https://forums.phpfreaks.com/topic/80089-trying-to-get-a-literal-string-value-from-a-variable/ Share on other sites More sharing options...
PHP_PhREEEk Posted December 4, 2007 Share Posted December 4, 2007 echo $chosenPath; Should get you output for what gets defined in your IF/ELSE conditions. I don't know where you are getting $row[] as an array from. Is there a MySQL pull in there that you did not post? PhREEEk Link to comment https://forums.phpfreaks.com/topic/80089-trying-to-get-a-literal-string-value-from-a-variable/#findComment-405876 Share on other sites More sharing options...
fotobleu Posted December 4, 2007 Author Share Posted December 4, 2007 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 https://forums.phpfreaks.com/topic/80089-trying-to-get-a-literal-string-value-from-a-variable/#findComment-405880 Share on other sites More sharing options...
fotobleu Posted December 4, 2007 Author Share Posted December 4, 2007 on line $pathToRSSThumb = $row[$chosenPath]; im not getting a value in the $pathToRSSThumb Link to comment https://forums.phpfreaks.com/topic/80089-trying-to-get-a-literal-string-value-from-a-variable/#findComment-405881 Share on other sites More sharing options...
fotobleu Posted December 4, 2007 Author Share Posted December 4, 2007 this is funny i keep posting myself, i just realized my mistake, in the sql statement i'm not even pulling some of those column names i'm only pulling fotos_thumbpath lol, noob error Link to comment https://forums.phpfreaks.com/topic/80089-trying-to-get-a-literal-string-value-from-a-variable/#findComment-405882 Share on other sites More sharing options...
PHP_PhREEEk Posted December 4, 2007 Share Posted December 4, 2007 alrighty then... lol PhREEEk Link to comment https://forums.phpfreaks.com/topic/80089-trying-to-get-a-literal-string-value-from-a-variable/#findComment-405883 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.