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? Quote Link to comment 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] Quote Link to comment 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] Quote Link to comment 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 ';' Quote Link to comment 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"; Quote Link to comment 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 Quote Link to comment 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"; Quote Link to comment 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. Quote Link to comment 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 Quote Link to comment 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? Quote Link to comment 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 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.