3 Replies - 303 Views - Last Post: 02 December 2012 - 02:48 PM Rate Topic: -----

#1 isra007  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 02-December 12

Im having issues coding css

Posted 02 December 2012 - 01:32 PM

HI all, so first of all the following code works, it pulls out cars from a database and displays it on a table on my website. The problem I am having
is formatting the table with css code I want to be able to change the table background. change the font size and color of Car Size and Image and other minor things.
any help is appreciated

/*note i am linking successfully to my external css sheet */

<?php

mysql_connect("localhost","user","blah") or die(mysql_error());// connect to the database
  mysql_select_db("blah") or die(mysql_error()); // select database
$query = mysql_query("SELECT * FROM cars where carType = 'ford' AND active = 1")  or die(mysql_error());

echo "<div id = 'tabledbs'>";
echo"<table border cellpadding = 3>";

if(mysql_num_rows($query) > 0){
echo"<tr><th>Car Name</th>                                                                                                     
<th>Image</th</tr>";
   while($row = mysql_fetch_array($query)){

/* Displays contents from database */
echo"<tr><td>" .$row['name'] . "</td>                                                                                              
<td><img src='".$row['imagePath'] ."'width='160' height='130'/></td></tr>";
echo "</div>";
   }
}else{

   echo "There are no cars to be displayed in the website;

}

?>



this is my attempt on my external css file

#tabledbs{background_color:black}
//would also like to change font size,colors,etc




Is This A Good Question/Topic? 0
  • +

Replies To: Im having issues coding css

#2 CTphpnwb  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 3077
  • View blog
  • Posts: 10,790
  • Joined: 08-August 08

Re: Im having issues coding css

Posted 02 December 2012 - 02:00 PM

The table is rendered on top of tabledbs, which is a div, not a table.
Was This Post Helpful? 0
  • +
  • -

#3 laytonsdad  Icon User is offline

  • Cheese and Sprinkles
  • member icon

Reputation: 446
  • View blog
  • Posts: 1,906
  • Joined: 30-April 10

Re: Im having issues coding css

Posted 02 December 2012 - 02:47 PM

Why not just give the table a class and style it that way.
Also you don't close your table tag.

This post has been edited by laytonsdad: 02 December 2012 - 02:50 PM

Was This Post Helpful? 0
  • +
  • -

#4 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 3572
  • View blog
  • Posts: 10,414
  • Joined: 08-June 10

Re: Im having issues coding css

Posted 02 December 2012 - 02:48 PM

its background-color, not background_color (would have been mentioned in the (CSS) error console)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1