1042 Posted October 25, 2006 Share Posted October 25, 2006 Hi all, i have the following code that displays data in a double column in the formatid1|id2id3|id4id5|id6[code] $getpress = mysql_query("SELECT * FROM events ORDER BY eventid ASC");//query the database for all of the news$i = 1; // counter var$cols = 2; // or however many columns you wantecho "<table>";while($r=mysql_fetch_array($getpress)){//while there are rows in the tableextract($r);//remove the $r so its just $variableif ($i == 1) echo "<tr>"; // start new row echo "<td td width=\"50%\"><font color=#000000><strong>$eventtitle</strong></font><br><font color=black>$eventinfo </font><br><font color=blue>$eventlink </font><br></td>"; if ($i == $cols) { // we've reached the end of our number of cols so end the row and reset the counter $i = 0; echo "</tr>"; } $i++; // increment our counter}if ($i != $cols) echo "</tr>"; // if we haven't finished off the row end it nowecho "</table>"; [/code]what would i need to change to display the data in the formatid1|id4id2|id5id3|id6thanks to all in advance. Quote Link to comment https://forums.phpfreaks.com/topic/25040-change-column-data-displayed/ Share on other sites More sharing options...
HuggieBear Posted October 25, 2006 Share Posted October 25, 2006 OK, you need to use MySQL result... I'm just looking up some code I have that will do the job.RegardsHuggie Quote Link to comment https://forums.phpfreaks.com/topic/25040-change-column-data-displayed/#findComment-114133 Share on other sites More sharing options...
1042 Posted October 26, 2006 Author Share Posted October 26, 2006 thanks, i would really appreciate your help. Quote Link to comment https://forums.phpfreaks.com/topic/25040-change-column-data-displayed/#findComment-114625 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.