The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Web Design
> CSS Help
|
Positioning an element [was: PHP Coding help]
Discuss Positioning an element [was: PHP Coding help] in the CSS Help forum on Dev Shed. Positioning an element [was: PHP Coding help] Cascading Style Sheets (CSS) forum discussing all levels of CSS, including CSS1, CSS2 and CSS Positioning. CSS provides a robust way of applying standardized design concepts to your web pages.
|
|
 |
|
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

December 18th, 2012, 02:11 PM
|
|
|
|
PHP Coding help
Hi
I am having bit of trouble with PHP coding
I need the testimonials name to be at the top like the name one is in the link
http://irhwebsites.co.uk/html5%20think%20simple/testimonials.php
Below is the coding for the testimonials.php
PHP Code:
<?php mysql_connect("hostname", "usernamename", "password") or die(mysql_error()); mysql_select_db("dbname") or die(mysql_error()); $data = mysql_query("SELECT * FROM tablename") or die(mysql_error()); Print "<table cellpadding=3 class='testimon'>"; while($testimonials = mysql_fetch_array( $data )) { Print "<tr>"; Print "<th>Name:</th> <td> ".$testimonials['name'] . "</td></tr>"; Print "<tr><th>Testimonial:</th> <td> ".$testimonials['testimonial'] . "<br><br></td></tr>"; } Print "</table>"; ?>
Any ideas
I tried setting a class in the php like <th class='testimonial'> but that didn't work
|

December 18th, 2012, 02:21 PM
|
 |
Likely to be eaten by a grue.
|
|
Join Date: Oct 2006
Location: Pennsylvania, USA
|
|
|
Please paste your code into the big white box, highlight it, and then click the white [PHP] icon.
__________________
HEY! YOU! Read the New User Guide and Forum Rules
"They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." -Benjamin Franklin
"The greatest tragedy of this changing society is that people who never knew what it was like before will simply assume that this is the way things are supposed to be." -2600 Magazine, Fall 2002
Think we're being rude? Maybe you asked a bad question or you're a Help Vampire. Trying to argue intelligently? Please read this.
|

December 18th, 2012, 02:41 PM
|
|
|
The coding is below
PHP Code:
<?php mysql_connect("hostname", "usernamename", "password") or die(mysql_error()); mysql_select_db("dbname") or die(mysql_error()); $data = mysql_query("SELECT * FROM tablename") or die(mysql_error()); Print "<table cellpadding=3 class='testimon'>"; while($testimonials = mysql_fetch_array( $data )) { Print "<tr>"; Print "<th>Name:</th> <td> ".$testimonials['name'] . "</td></tr>"; Print "<tr><th>Testimonial:</th> <td> ".$testimonials['testimonial'] . "<br><br></td></tr>"; } Print "</table>"; ?>
|

December 18th, 2012, 02:43 PM
|
|
|
|
You didn't need to repost, you could have just edited the original. However, you obviously did not follow ManiacDan's instructions.
1) Edit either post
2) Delete all PHP tags
3) Highlight just the code
4) Click the PHP icon
5) Submit
__________________
There are 10 kinds of people in the world. Those that understand binary and those that don't.
|

December 18th, 2012, 02:49 PM
|
 |
JavaScript is not spelt java
|
|
Join Date: Feb 2011
Location: Landan, England
|
|
Quote: I need the testimonials name to be at the top like the name one is in the link
http://irhwebsites.co.uk/html5%20think%20simple/testimonials.php |
I do not understand what this means and your code still needs to be shown correctly - not on one line.
|

December 18th, 2012, 02:56 PM
|
|
|
|
That's what I did, I deleted the PHP tags and then highlighted the PHP coding and clicked the PHP icon and a popup box appeared and pasted in the php coding in the pop up box
|

December 18th, 2012, 03:04 PM
|
|
|
|
I am pasting the coding in here but is just putting it all one line when I click the white php icon
|

December 18th, 2012, 03:05 PM
|
|
Contributing User
|
|
Join Date: Jun 2009
Posts: 294
  
Time spent in forums: 3 Days 8 h 6 m 9 sec
Reputation Power: 5
|
|
|
Ah, I think I got ya. For this I believe you would want to look into CSS and alignment.
|

December 18th, 2012, 03:08 PM
|
|
|
Ok will have a look and see but when I looked at the css for the table and th etc was not sure what to change
The css for the table is below
Code:
table {
border-collapse: collapse;
}
th, td {
border: 0px solid: #000000;
}
td {
border: 0px solid: #000000;
}
tr {
border: 0px solid: #000000;
}
}
|

December 18th, 2012, 03:12 PM
|
|
Contributing User
|
|
Join Date: Jun 2009
Posts: 294
  
Time spent in forums: 3 Days 8 h 6 m 9 sec
Reputation Power: 5
|
|
|
I wouldn't edit any tables tags for this. I would create your own name/id and set your desired settings. As far as your search for alignment, you will be looking for vertical alignment for up/down, and not horizontal.
|

December 18th, 2012, 03:16 PM
|
|
|
|
How do I create a class or id in php coding
<?php mysql_connect("hostname", "usernamename", "password") or die(mysql_error()); mysql_select_db("dbname") or die(mysql_error()); $data = mysql_query("SELECT * FROM tablename") or die(mysql_error()); Print "<table cellpadding=3 class='testimon'>"; while($testimonials = mysql_fetch_array( $data )) { Print "<tr>"; Print "<th>Name:</th> <td> ".$testimonials['name'] . "</td></tr>"; Print "<tr><th>Testimonial:</th> <td> ".$testimonials['testimonial'] . "<br><br></td></tr>"; } Print "</table>"; ?>
|

December 18th, 2012, 03:19 PM
|
|
Contributing User
|
|
Join Date: Jun 2009
Posts: 294
  
Time spent in forums: 3 Days 8 h 6 m 9 sec
Reputation Power: 5
|
|
|
This has nothing to do with PHP. This is between HTML and CSS. Sorry. :-/
Note: When you paste coding here, copy from original document and paste in same box you type the rest of your stuff in. Then highlight that code you just pasted, and click the CODE/PHP tag link.
Last edited by Triple_Nothing : December 18th, 2012 at 03:21 PM.
|

December 18th, 2012, 03:26 PM
|
|
|
ok so if I do a class to the th like the following
Code:
<th class="testimonial">
will that work yeah and in the css do I add it like the following
is that right
|

December 18th, 2012, 03:35 PM
|
 |
JavaScript is not spelt java
|
|
Join Date: Feb 2011
Location: Landan, England
|
|
|
Yes, that is correct.
BTW you have a spare } at the end of your previous CSS code.
|

December 18th, 2012, 03:36 PM
|
|
|
|
Oh yeah thank you for spotting that, that extra } can't help
I will try adding the class and let you know, hopefully will work
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|