I have a mysql query that I want to print into a table, I can do it for cells one about each other but what if I want it to be 3 results wide and then endless deep until the results expire... who do I do this???
So you can get all the result and print them as my code of line showed...the firs line starts the table, then you print out a whole row in one go, then next round in the loop you print the next row and so on....
Last edited by Electroman; May 2nd, 2004 at 01:47 PM.
When your thread has been resolved please edit the original post in the thread ()
and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.
When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.
Originally posted by Chroder How..? You can't get three rows at once, unless you use 3 different variables which isn't very practical.
Or are you saying that for the sake of argument
I didn't say it was practical or anything. And I have told you 3 times how to do it now. I was not trying to argue with you. You started to say it was not dynamicaly, and that is just PLAIN wrong. I am uing it at my site right now. And it HELL is dynamicaly... So I will not argue now. Kiwis has 3 difrent ways to do it. And I don't care what version he uses....
Mine produces the nicest looking HTML at the end . Choose mine, choose mine .
Posted by Chroder So you'd rather do it that way?
was that aimed at me or Note .
When your thread has been resolved please edit the original post in the thread ()
and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.
When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.
Originally posted by NoteMe
And I have told you 3 times how to do it now.
No you haven't
You started to say it was not dynamicaly, and that is just PLAIN wrong.
I was responding to your first example, which was not looping through a mysql result. Sorry if I worded it wrong.
Why not?
Your using more memory getting three values at once. Or using a loop within a loop is kinda weird -- the whole thing can be done with one variable, one loop. Why do more work then needed? I'm sure there are situations where you would need three values at once, to compare or something, but here it's not needed.
But that's PHP for you, multiple ways to achieve the same result.
Last edited by Chroder; May 2nd, 2004 at 03:50 PM.
Depends on what you prefer, I'd agree running out of memory isn't really a problem. From a programmers standpoint though, I just find using one value, one loop, a lot easier to read then using three values or nested loops.
Imagine if you have to work with those values, addslashes for example. You'd have 2 more extra lines, and if you used a nested loop, then you'd have to copy+paste.
Originally posted by Chroder
I was responding to your first example, which was not looping through a mysql result. Sorry if I worded it wrong.
'
I was tellin how to print the table. Not how to get the results from the query......He didn't ask how to do that, so I guess he figgured that out him self. Like you didn't provide the whole code for the whole page. And if you are so good in PHP, then why tripping on me not showing the WHOLE code.
Originally posted by Chroder lol I see But I get the points of NoteMe and Electroman though, wans't trying to prove anyone wrong or anything. Hope it didn't appear that way
It's ok...just got a bit anoyed by your first posts. But it's ok....I had been struggeling with a CSS questions for 2,5 days, and was a bit tired, so what you did was just to push me over. No hard fealings...
I was tellin how to print the table. Not how to get the results from the query......He didn't ask how to do that, so I guess he figgured that out him self.
He asked how to print the results from a mysql into a table. I would assume he would need to loop through the results. But maybe he didn't.
Like you didn't provide the whole code for the whole page. And if you are so good in PHP, then why tripping on me not showing the WHOLE code.
I'm not tripping out. I haven't said anything. I don't know how your are reading my comments but I am not intending to say anything offensive, and I am certainly not "tripping out". Sorry if it sounds that way.
It's ok...just got a bit anoyed by your first posts. But it's ok....I had been struggeling with a CSS questions for 2,5 days, and was a bit tired, so what you did was just to push me over. No hard fealings..
Originally posted by Chroder
I'm not tripping out. I haven't said anything. I don't know how your are reading my comments but I am not intending to say anything offensive, and I am certainly not "tripping out". Sorry if it sounds that way.
Are you not going to quit soon. The thing was that I posted a solution, then you questioned that one, then I answered the solution to that one, and then you wuestioned that one too, and I answered that one too, and then you had all ready pushed me over.
I am using this solution my self, and it works fine. If you have comments on my code, please let me know, but you don't need to question all my answers. Let the thread starter ask questions if there is something he doesn't understand.
You're over-reacting. One, I didn't believe that your solution helped solve the problem so I posted my own. You said something about putting the loop inbetween the table tags, all I said was you'd still need three values. You said that you could do that, I asked how, and this got started.
I've appologized many times, if you don't want to accept it then fine. Be on your way.
lol , you to are like a pair of b*tches. Maybe better than when Note & Keda get in one of these. For proof search the forums for: Note, Keda, I, Am, Right, You ,Are, Wrong, Functional, Programming, Eat, This & lots of beeps and disallowed words .
BTW I hope you didn't think I was tring to say your solutions were wrong by posting my own solution. I just saw the two of you already fighting and noticed that both your solutions would only work if the amount of records was divisable by 3. Although Chroder's would work the last row would be messed up.
Now you two play nice you hear .
When your thread has been resolved please edit the original post in the thread ()
and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.
When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.
But the last row only has 2 cells in, yes? so it looks strange, its like normal apart from the last two colunms wouldn't be indented. hang on I'll make a screeny.....
When your thread has been resolved please edit the original post in the thread ()
and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.
When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.
Oh I get what you mean, I thought you meant there would be an extra <tr> or something. Browsers just display the one cell, unless it's against the standards. Never thought of it
Ow right no, just that it wouldn't appear right. I tried to stop the screen shot but it was too late. I'll just post it anyway .
When your thread has been resolved please edit the original post in the thread ()
and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.
When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.
Its even more fun when you have lots of rows and one has just one too many cells than it should, the whole thing has a chunk sticking out of it.
When your thread has been resolved please edit the original post in the thread ()
and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.
When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.
It was becuase of the "probelem" you guys are talking about now I said you should check how many results you had in the query before displaying it so you could handle this in the way you wanted....