Jump to content

TheAlmightyOS

New Members
  • Posts

    3
  • Joined

  • Last visited

TheAlmightyOS's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Alright. I have been going back and forth between the two. Will focus more on php.net Might try that out. Thanks!
  2. Thank you! It worked! Here I thought it was a different problem entirely. So the Table Headers are Solved. My second question (I will make another thread if asked) is the conditional formatting. I know my way around an if/than statement but there is so much going on here in regards to the PHP, table code and variables that I do not know where to start it. There are a few goals here: to identify data that is website location (ex http://) and format it as a hyperlink and tag specific text with special formatting. I think I can figure out the if statement, but where it goes? On line 35 or line 36, I am uncertain. And would it be if($row or if($result?. Heading to w3c to do some more reading. Thank you for the help thus far!
  3. Alright, I looked though the read me's, went over the FAQ's... Think it is time to post... So, this lump is what I got from going though google and piecing together the bits that looked good. <?php $db_host = "****"; $db_user = "****"; $db_pwd = "****"; $database = "****"; $table = "****"; $query = "SELECT * FROM {$table}"; $conn = mysqli_connect($db_host, $db_user, $db_pwd, $database); $result = mysqli_query($conn,$query) or trigger_error($query . ' - has encountered an error at:<br />' . mysqli_error($conn)); $fields = mysqli_fetch_fields($conn); $field_count = mysqli_num_fields($conn); echo '<table border="1" style="width:100%">' . "\n" . '<tr>'; $i = 0; foreach($fields as $field) { if(++$i == 1) { echo '<th colspan="' . $field_count . '">' . $field->table . '</th></tr><tr>'; } echo "\n" . '<th>' . $field->name . '</th>'; } echo '</tr>'; while($row = mysqli_fetch_row($result)) { echo '<tr><td>' . implode('</td><td>' , $row) . '</td></tr>'; } echo '</table>'; ?> The goal is to display the table and conditionally format the contents. Let's forget about the conditional part (thinking if/than but don't know how I'm going to do that yet) and focus on the key problem: displaying the table. I have tested this code. It works...to a point. it displays the table and its contents but no headers. I know my issue is in line 20 and 22 but I can not for the life of me figure it out. If it is stupidly easy (for you) please remember that I am not a coder. At best I am a scripter when it comes to linux. I am over my head on this stuff. Thank you all for any help you can give me
  4. Hello all. Callsign is TheAlmightyOS, most of my gamer friends just call me OS. Almost didn't make it in here. That account creation botcheck was BRUTAL. Someone needs to check on that cause there is no way I was getting it wrong every time. Anyway, I am here cause I need some help. I am a gamer (and a moon-light server admin), not a coder. But I got a project now that involves some php and I can't get help anywhere. They ether tell me the API I am using is depreciated (it isn't) and won't help me or they just say "your error is on line x" and then leave me to hang. So, well, I am hoping you guys see I am not trying to write the most perfect web site ever and give a hand. Looking forward to meeting all of you.
×
×
  • 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.