I'm new to this website. I have a question about how PHP formats a table but don't know where to post it. I inherited a website that has a database in Google and files written in PHP and HTML. The info from the database is posted into a table but I can't figure out how to change the dimensions of the table columns. The formatting is not being done in the HTML -- I've tried changing colum sizes but the table just snaps back to it's original formatting. Where is table formatting done in PHP? I don't know PHP but I think I could figure it out with the help of the manual if I knew what to look for.
Thanks, Penelope

you need to learn embeeding php code with html to show dynamic data.

what u mean by google database?

Member Avatar for diafol

Show your output (view source and copy/paste). Are you sure it's not being set in CSS? Or even js?

I know it's not being set in CSS but I think it might be being set in the database itself. Could PHP be taking the params for the table from the databse?

Copied from Database -- My highlighting -- are these types what control the table's cols and rows?

Field Type Attributes Null Default Extra Action
Web_ID int(4) No Browse distinct values Change Drop Primary Unique Index Fulltext
Name text No Browse distinct values Change Drop Primary Unique Index Fulltext
Type varchar(20) No Browse distinct values Change Drop Primary Unique Index Fulltext
DayofWeek varchar(10) No Browse distinct values Change Drop Primary Unique Index Fulltext
DayNumber int(11) No Browse distinct values
Gender text No Browse distinct values Change Drop Primary Unique Index Fulltext
Details text No Browse distinct values Change Drop Primary Unique Index Fulltext

Member Avatar for diafol

THat doesn't really help. Can't you just copy and paste the html from the view source of your browser?

Those numbers from the database are MySQL data type specifications, they have nothing to do with the HTML table display. The look of your end webpage is controlled only by HTML and CSS, which will be found in one of three locations:

  • Inline style attribute in the HTML tags / deprecated HTML styling in the tags
  • <style> tag in the page itself
  • External CSS file

The other possibility to keep in mind with HTML tables is that their width is often determined by the width of the first row. IF you're setting the first row to say, 4 cells of 25% width, and then trying to set them to 40%/40%/10%/10% in the second row, it probably won't cooperate.

It's impossible to determine exactly which of these things is going on without seeing your code though, so it would help if you could post that.

Thanks everyone. After reading the posts I went back to the css file and the html and managed to figure out how to get the columns formatted the way I wanted them. I also changed the varchar() on the first column (the words were being truncated). I guess this wasn't a PHP problem after all, sorry :(

Member Avatar for diafol

Great pk, thanks for coming back.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.