SQL query in pyramid structure |
SQL query in pyramid structure |
Barbara |
Dec 17 2015, 04:59 PM
Post
#1
|
Group: Members Posts: 2 Joined: 17-December 15 Member No.: 23,837 |
Hi! I have problem with displaying sql query in pyramid structure (it is made like a table). I am working in Wordpress. I want to display name by his pyramid number and I want to show it in table (pyramid). I don't know what loop is best for that. I have made something like this: get_results("SELECT pyramid_number, CONCAT(name,' ',last_name) AS user_name FROM users");?>
And this is the first row of my pyramid. I have tried to put pyramid number inside <td> and user_name between <td></td> but obviously I don't know how. <table class="pyramid"> <tbody> <tr> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td if pyramid_number=1>user_name</td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> </tr> |
CharlesEF |
Dec 17 2015, 07:07 PM
Post
#2
|
Programming Fanatic Group: Members Posts: 1,981 Joined: 27-April 13 From: Edinburg, Texas Member No.: 19,088 |
I know nothing about Wordpress but if you are using PHP for this then you need to post your code.
|
Barbara |
Dec 18 2015, 02:29 AM
Post
#3
|
Group: Members Posts: 2 Joined: 17-December 15 Member No.: 23,837 |
|
CharlesEF |
Dec 18 2015, 04:26 AM
Post
#4
|
Programming Fanatic Group: Members Posts: 1,981 Joined: 27-April 13 From: Edinburg, Texas Member No.: 19,088 |
I know nothing about Wordpress but if you are using PHP for this then you need to post your code. I don't understand. You've already shown this part of code: CODE get_results("SELECT pyramid_number, CONCAT(name,' ',last_name) AS user_name FROM users");?> That line is part of PHP code because of the PHP closing tag '?>'. 'get_results(...)' is a Wordpress function, most likely written in PHP, that will query the database and return the data, in this case 'pyramid_number' and 'user_name'. The function call needs a variable to hold the data so the actual code would be something like this: '$somevaraible = get_results(...);'. At this point you would need PHP code to build the table and insert the data. The table can't be hard coded because you won't know how much data is returned.I can help you write the PHP code but I can't write it for you. But, in order to help I would need to see the PHP code you are working on (or attach the page to a post). How much programming experience do you have? This post has been edited by CharlesEF: Dec 18 2015, 04:32 AM |
Lo-Fi Version | Time is now: 5th June 2024 - 12:38 AM |