fat creative Posted June 11, 2008 Share Posted June 11, 2008 I'm trying to limit the number of characters returned and have the following code: $query = "SELECT * FROM GFF WHERE featured_site = 'yes'"; $result = mysql_query($query) or die ("Couldnt execute query"); $prop = substr($prop_desc, 0, 150); echo "<table cellspacing=\"15\">\n"; while($row = mysql_fetch_assoc($result)) { extract($row); echo "<tr><td valign=\"top\">"; echo "<img src=\"$thumb_image\" width=\"125\" height=\"94\" align=\"middle\" ></td>"; echo "<td valign=\"top\"><a href=\"showdetails.php?id_number=$id_number\"><b>$prop_title</b></a><br />"; echo "$prop<br />"; echo "<a href=\"showdetails.php?id_number=$id_number\"><div align=\"right\"><b>View Details</b></div></a>"; echo "</td></tr>\n"; } echo "</table>\n"; It looks like such a simple thing, but as a newbie, I'm obviously missing something since it's not working! My page is at www.FatCreative.com/GFF. If I just say echo $prop_desc, then it works fine, but doesn't look nice. When I put in $prop = substr($prop_desc, 0, 150); and echo "$prop<br />"; then it returns nothing. Any thoughts anyone? I think this is the last thing I need to finish this project. Thank you so much in advance for ANY suggestions / advice! Quote Link to comment Share on other sites More sharing options...
DarkWater Posted June 11, 2008 Share Posted June 11, 2008 Call me crazy, but I don't see where you set $prop_desc. And if it's supposed to come from that extract() call, then the $prop = substr() line needs to be in the while loop. =P Quote Link to comment Share on other sites More sharing options...
btherl Posted June 11, 2008 Share Posted June 11, 2008 I think darkwater is right - your code should look like: while($row = mysql_fetch_assoc($result)) { extract($row); $prop = substr($prop_desc, 0, 150); with the rest remaining as it is already. Quote Link to comment Share on other sites More sharing options...
fat creative Posted June 11, 2008 Author Share Posted June 11, 2008 Noone's crazy here, just much much smarter than me. I didn't realize it mattered if the statement was in the while loop. I have SO MUCH to learn. Thank you, Darkwater, Bther - you were both spot on! Quote Link to comment Share on other sites More sharing options...
DarkWater Posted June 11, 2008 Share Posted June 11, 2008 Noone's crazy here, just much much smarter than me. I didn't realize it mattered if the statement was in the while loop. I have SO MUCH to learn. Thank you, Darkwater, Bther - you were both spot on! It only matters because that's where you set the $row variable (which you then extract), giving you $post_desc. =) Glad I could help, lol. (Oh, btw, is it really hot in Atlanta? I'm going there for like, a 4 day business conference...and I don't want to die.) Quote Link to comment Share on other sites More sharing options...
fat creative Posted June 11, 2008 Author Share Posted June 11, 2008 You certainly did! The things that seem like they should be so easy frustrate me the most. I unfortunately just missed signing up for a class at the local college when this project came up. I am definitely signing up the next semester. And I remember you said you had a conference coming up here in GA. I hope that link for the list of things to do in Atlanta was helpful. YES it is VERY HOT. Well humid. You will pretty much walk outside and be SOAKED in a matter of minutes. Be warned. :-) And thanks again... Quote Link to comment Share on other sites More sharing options...
DarkWater Posted June 11, 2008 Share Posted June 11, 2008 D'oh. >_< I thought it was bad in New York today....100 degrees (air temperature) and it felt like 108 some times during the day with humidity...I was dying in school. Greatttt....At least I get to stay at a nice hotel. =P Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.