Page 1 of 2 12 Last
  • Jump to page:
    #1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2012
    Posts
    153
    Rep Power
    13

    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>&nbsp;".$testimonials['name'] . "</td></tr>"; Print "<tr><th>Testimonial:</th> <td>&nbsp;".$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
  2. #2
  3. Sarcky
    Devshed Supreme Being (6500+ posts)

    Join Date
    Oct 2006
    Location
    Pennsylvania, USA
    Posts
    10,846
    Rep Power
    6351
    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.
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2012
    Posts
    153
    Rep Power
    13
    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>&nbsp;".$testimonials['name'] . "</td></tr>"; Print "<tr><th>Testimonial:</th> <td>&nbsp;".$testimonials['testimonial'] . "<br><br></td></tr>"; } Print "</table>"?>
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Jul 2003
    Posts
    3,350
    Rep Power
    594
    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.
  8. #5
  9. JavaScript is not spelt java
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2011
    Location
    Landan, England
    Posts
    743
    Rep Power
    165
    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.
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2012
    Posts
    153
    Rep Power
    13
    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
  12. #7
  13. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2012
    Posts
    153
    Rep Power
    13
    I am pasting the coding in here but is just putting it all one line when I click the white php icon
  14. #8
  15. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Jun 2009
    Posts
    676
    Rep Power
    7
    Ah, I think I got ya. For this I believe you would want to look into CSS and alignment.
  16. #9
  17. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2012
    Posts
    153
    Rep Power
    13
    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;
    }
    }
  18. #10
  19. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Jun 2009
    Posts
    676
    Rep Power
    7
    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.
  20. #11
  21. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2012
    Posts
    153
    Rep Power
    13
    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>&nbsp;".$testimonials['name'] . "</td></tr>"; Print "<tr><th>Testimonial:</th> <td>&nbsp;".$testimonials['testimonial'] . "<br><br></td></tr>"; } Print "</table>"; ?>
  22. #12
  23. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Jun 2009
    Posts
    676
    Rep Power
    7
    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.
  24. #13
  25. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2012
    Posts
    153
    Rep Power
    13
    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

    Code:
    th.testimonial
    is that right
  26. #14
  27. JavaScript is not spelt java
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2011
    Location
    Landan, England
    Posts
    743
    Rep Power
    165
    Yes, that is correct.

    BTW you have a spare } at the end of your previous CSS code.
  28. #15
  29. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2012
    Posts
    153
    Rep Power
    13
    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
Page 1 of 2 12 Last
  • Jump to page:

IMN logo majestic logo threadwatch logo seochat tools logo