Jump to content

how to show data ...in....


nec9716

Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

....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""

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.