patsman77 Posted June 13, 2010 Share Posted June 13, 2010 Hello All, I was wondering if someone could guide me a little. I have this code I am working on, but it displays 1 line at a time. Basically what I want is to break it up so that it dispalys across instead of down, but it sections. Each section will be VISITOR (w/logo) then line 2 SPREAD, then line 3 HOME (w/logo) Section 1 ; section 2; section 3; ......etc not visitor (w/logo) spread Home (w/logo) visitor (w/logo) spread Home (w/logo) visitor (w/logo) spread Home (w/logo) ... etc Here is the code I am working with: <? $sql = "SELECT * FROM ".$football->prefix."picks, ".$football->prefix."schedule, ".$football->prefix."teams WHERE USER = '".$user."' AND week = '".$week."' AND ".$football->prefix."picks.gameid = ".$football->prefix."schedule.gameid AND ".$football->prefix."picks.pick = ".$football->prefix."teams.id ORDER BY ".$football->prefix."schedule.gametime, ".$football->prefix."schedule.gameid"; $result = $football->dbQuery($sql); $nRows = mysql_num_rows($result); $upicks = ""; for ($i=0; $i< $nRows; $i++){ $row = mysql_fetch_array($result); $pickcity = $row['city']; $pickname = $row['name']; $gameid = $row['gameid']; $pick = $row['pick']; $sql="select ".$football->prefix."schedule.*, ".$football->prefix."teams.city as VCity, ".$football->prefix."teams.name as VName, ".$football->prefix."teams.display as VDisplayName, ".$football->prefix."teams.icon as Vicon, teams2.city as HCity, teams2.name as HName, teams2.display as HDisplayName, teams2.icon as Hicon from (".$football->prefix."schedule inner join ".$football->prefix."teams on ".$football->prefix."schedule.vid = ".$football->prefix."teams.id) inner join ".$football->prefix."teams as teams2 on ".$football->prefix."schedule.hid = teams2.id where ".$football->prefix."schedule.gameid = '".$gameid."'"; $pickresult = $football->dbQuery($sql); $prow = mysql_fetch_array($pickresult); $game = ""; $vid = $prow['vid']; $vcity = $prow['VCity']; $vname = $prow['VName']; $vicon = $prow['Vicon']; $hid = $prow['hid']; $hcity = $prow['HCity']; $hname = $prow['HName']; $hicon = $prow['Hicon']; $gametime = $prow['gametime']; $date = date("m/d/Y",$gametime); $time = date("H:i:s A",$gametime); $ts = $football->doDate($date,$time,$football->display_offset); $day = date("D",$ts); $month = date("M d",$ts); $time = date("g:i a",$ts); if ($vid == $pick) { $visitor = "<b><u>"; $visitor .= $vid; $visitor .= "</b></u>"; } else { $visitor = $vid; } echo "$visitor"; echo "<img src = \"".$football->copyrightweb."/images/$vicon\" width=".$football->logo_width.">\n"; if ($hid == $pick) { $home = "<b><u>"; $home .= $hid; $home .= "</b></u>"; } else { $home = $hid; } echo "<br>at<br> $home"; echo "<img src = \"".$football->copyrightweb."/images/$hicon\" width=".$football->logo_width.">"; echo "</tr>\n"; } echo "</table>\n"; echo "<br><br><br><b>TB: ".$tb."</b>\n"; echo "<br><br>\n"; ?> Any help would be appreciated. Thanks, Patsman77 Link to comment https://forums.phpfreaks.com/topic/204679-php-sql-display/ Share on other sites More sharing options...
Catfish Posted June 14, 2010 Share Posted June 14, 2010 <br> in the output will create line breaks. edit the <br> formatting to suit your needs. Link to comment https://forums.phpfreaks.com/topic/204679-php-sql-display/#findComment-1071639 Share on other sites More sharing options...
patsman77 Posted June 15, 2010 Author Share Posted June 15, 2010 It does not appear there are any <br> that affect this code. Does anyone have any suggestions on how to make each "section" display side by side instead of vertically? Link to comment https://forums.phpfreaks.com/topic/204679-php-sql-display/#findComment-1072596 Share on other sites More sharing options...
patsman77 Posted June 15, 2010 Author Share Posted June 15, 2010 Solved: { $item = "<td>"; if ($vid == $pick){ $item .= "<b><font color=#FF0000>$vid</font></b>"; } else { $item .= "<font color=#000000>$vid</font>"; } $item .= "<br>"; if ($hid == $pick){ $item .= "<b><font color=#FF0000>$hid</font></b>"; } else { $item .= "<font color=#000000>$hid</font>"; } $item .= "</td>"; } echo $item; } Link to comment https://forums.phpfreaks.com/topic/204679-php-sql-display/#findComment-1072711 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.