ltoto Posted September 19, 2006 Share Posted September 19, 2006 I want to style the $name in this, so i want to put a div ta around it, but I am unsure of how to put the div tag or where to put it[code]while ($row = mysql_fetch_array($result, MYSQL_ASSOC)){ $name = $row['hotelName']; $description = $row['hotelDescription']; $rating = $row['hotelRating']; $image = "<img src=\"../thumb/phpThumb.php?src=../images/hotel_{$row['hotelImage']}&w=100&h=100&zc=1\" alt=\"Hotel\">"; // List the hotels echo "$image $name $rating $description<br> \n";}[/code]any suggestions? Link to comment https://forums.phpfreaks.com/topic/21254-php-div-tag-help-please/ Share on other sites More sharing options...
onlyican Posted September 19, 2006 Share Posted September 19, 2006 try this[code]<?phpecho "<div id='blah'>".$image." ".$rating." ".$description."</div><br />\n";?>[/code] Link to comment https://forums.phpfreaks.com/topic/21254-php-div-tag-help-please/#findComment-94531 Share on other sites More sharing options...
Barand Posted September 19, 2006 Share Posted September 19, 2006 If it is just the name, and not rating and description, use a span[code]echo "$image <span class='name'>$name</span> $rating $description<br>";[/code] Link to comment https://forums.phpfreaks.com/topic/21254-php-div-tag-help-please/#findComment-94536 Share on other sites More sharing options...
ltoto Posted September 19, 2006 Author Share Posted September 19, 2006 im going to style each one i did this[code]echo "<div class="content">".$image." ".$rating." ".$description."</div><br />\n";[/code]but i got a parse error which is thisParse error: parse error, unexpected T_STRING, expecting ',' or ';' Link to comment https://forums.phpfreaks.com/topic/21254-php-div-tag-help-please/#findComment-94538 Share on other sites More sharing options...
Barand Posted September 19, 2006 Share Posted September 19, 2006 you can't put " in a string contained within "suseecho "<div class=\"content\">".$image." ".$rating." ".$description."</div><br />\n";orecho "<div class='content'>".$image." ".$rating." ".$description."</div><br />\n"; Link to comment https://forums.phpfreaks.com/topic/21254-php-div-tag-help-please/#findComment-94541 Share on other sites More sharing options...
ltoto Posted September 19, 2006 Author Share Posted September 19, 2006 add they work now, thanks a lot Link to comment https://forums.phpfreaks.com/topic/21254-php-div-tag-help-please/#findComment-94543 Share on other sites More sharing options...
ltoto Posted September 19, 2006 Author Share Posted September 19, 2006 so if i wanted to put a new div tag in id say do thisecho "<div class='country'>".$image." ".$name." ".$rating." <div class='description'>".$description."</div>\n"; Link to comment https://forums.phpfreaks.com/topic/21254-php-div-tag-help-please/#findComment-94546 Share on other sites More sharing options...
Barand Posted September 19, 2006 Share Posted September 19, 2006 You have a /div tag missing to indicate where the 'country' div ends.Also, DIV is a block construct and will force a new line (unless you float them). If you want them on the same line use span tags. Link to comment https://forums.phpfreaks.com/topic/21254-php-div-tag-help-please/#findComment-94547 Share on other sites More sharing options...
ltoto Posted September 19, 2006 Author Share Posted September 19, 2006 i did this after your adviceecho "<div class='\country\'>".$image."<div class='\homebar2\'>".$name." ".$rating." ".$description."</div>\n";}but it brings the footer up for some reason Link to comment https://forums.phpfreaks.com/topic/21254-php-div-tag-help-please/#findComment-94567 Share on other sites More sharing options...
Barand Posted September 19, 2006 Share Posted September 19, 2006 Which advice was that, then? To put in the missing /div tag or to use span? Link to comment https://forums.phpfreaks.com/topic/21254-php-div-tag-help-please/#findComment-94613 Share on other sites More sharing options...
ltoto Posted September 19, 2006 Author Share Posted September 19, 2006 i made the mistake sorry just spotted it, i did something wrong is the rs, now its just being a nightmare to line up Link to comment https://forums.phpfreaks.com/topic/21254-php-div-tag-help-please/#findComment-94615 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.