nec9716 Posted March 18, 2008 Share Posted March 18, 2008 ok now that I'm able to create table in sql and able to write in it and able to look in it when I ask to look inside table it show me the data but all in line which now I put <BR> between each entry but even that how can I do to have that one row after another with 2 different color each row? and how can I do to get the date in straight column ? you don't have to write me the script ....but just a clue where I can look ...I kind of turn in round since few HRS to do that thank's everyone... have a great day Quote Link to comment Share on other sites More sharing options...
trq Posted March 18, 2008 Share Posted March 18, 2008 take a look at this code snippet. Quote Link to comment Share on other sites More sharing options...
bpops Posted March 18, 2008 Share Posted March 18, 2008 For alternating colors, I usually assign a variable, say $x = 0; Then flip it to 1 after a row, then back to 0, etc. to signify the different colors, then assign a color to 1 and 0. Or just keep incrementing it, and do a $x%2 on it to get the remainder. Quote Link to comment Share on other sites More sharing options...
nec9716 Posted March 18, 2008 Author Share Posted March 18, 2008 ....ok but ...you might not know but ..that just my second day in PHP...so how can I get this snippet working with this: <?php $db = mysql_connect('localhost','user','pass'); mysql_select_db('matnphil_f1',$db); $sql='SELECT id, name, teamname, driver1, driver2, driver3, chassis, engine, tiebreak1, tiebreak2 FROM player'; $req = mysql_query($sql)or die('Erreur SQL !<br>'.$sql.'<br>'.mysql_error()); while($data = mysql_fetch_assoc($req)) { echo ''.$data['id'].''.$data['name'].''.$data['teamname'].''.$data['driver1'].''.$data['driver2'].''.$data['driver3'].''.$data['chassis'].''.$data['engine'].''.$data['tiebreak1'].''.$data['tiebreak2'].'<br>'; } mysql_close(); ?> even with the alternating color ...I have no clue at all how to set my PHP script with "" $x=0"" Quote Link to comment Share on other sites More sharing options...
nec9716 Posted March 18, 2008 Author Share Posted March 18, 2008 Ok guy I get it working .... thank's 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.