aldrin151 Posted November 5, 2008 Share Posted November 5, 2008 Hi, sound kind of stupid but how do you display all records, instead of just one...my code displays the next_record only $db = new clsDBConnection1; $SQL = "SELECT sub_title FROM sub_cats where main_id='1'"; $db->query($SQL); $Results = $db->next_record(); echo $db->f("sub_title"); $db->close(); Quote Link to comment https://forums.phpfreaks.com/topic/131548-how-to-display-all-records-by-echo-in-php/ Share on other sites More sharing options...
corbin Posted November 5, 2008 Share Posted November 5, 2008 No idea what clsDBConnection1 is. Anyway, learn PHP; learn MySQL. Answering a question like this for you does nothing to help you in the long run. Anyway, it's probably the main_id=1 that is making it 1 row. Quote Link to comment https://forums.phpfreaks.com/topic/131548-how-to-display-all-records-by-echo-in-php/#findComment-683230 Share on other sites More sharing options...
aldrin151 Posted November 5, 2008 Author Share Posted November 5, 2008 Why the hell would you answer back to this post and mock someone to learn PHP & Mysql first when you don't know the answer or help...? Instead of stating next_record() to display the next record in the row, I wanted to see if I could leave it out and write something else to replace mysql_fetch_array($Results)...I'm using a new PHP code generator for your info DUDE! Quote Link to comment https://forums.phpfreaks.com/topic/131548-how-to-display-all-records-by-echo-in-php/#findComment-683250 Share on other sites More sharing options...
wildteen88 Posted November 5, 2008 Share Posted November 5, 2008 I'm using a new PHP code generator for your info DUDE! Don't expect any helpful replies then. Quote Link to comment https://forums.phpfreaks.com/topic/131548-how-to-display-all-records-by-echo-in-php/#findComment-683251 Share on other sites More sharing options...
corbin Posted November 5, 2008 Share Posted November 5, 2008 Why the hell would you answer back to this post and mock someone to learn PHP & Mysql first when you don't know the answer or help...? Instead of stating next_record() to display the next record in the row, I wanted to see if I could leave it out and write something else to replace mysql_fetch_array($Results)...I'm using a new PHP code generator for your info DUDE! I don't know the answer? AHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHA What are you, like 7? What the hell kind of response was that? I'm not surprised you're using a code generator. If you're using a code generator, why would me telling you to learn PHP/MySQL offend you? And by the way, I had assumed you were getting one result because of the ID thing. Try changing $Results = $db->next_record(); to while($Results = $db->next_record()) { //do something with Results. } I won't be coming back to this thread. Quote Link to comment https://forums.phpfreaks.com/topic/131548-how-to-display-all-records-by-echo-in-php/#findComment-683268 Share on other sites More sharing options...
aldrin151 Posted November 5, 2008 Author Share Posted November 5, 2008 No it wasn't the id thing since there are more sub_titles with that id...but thanks for the info...more like it...I didn't tell you to go learn PHP. You got it wrong...You should learn not to be arrogant when messaging back people on this forum... Quote Link to comment https://forums.phpfreaks.com/topic/131548-how-to-display-all-records-by-echo-in-php/#findComment-683282 Share on other sites More sharing options...
corbin Posted November 6, 2008 Share Posted November 6, 2008 You obviously don't know PHP though if you asked that question. It's easy to misread something. I assumed you were only getting one result from the DB query since anyone advanced enough to use an OOP interface to a DB knows how to use a while loop. I didn't even read the code after the SELECT statement. You should learn not to be arrogant when messaging back people on this forum... Yeah, I will never help you again. How is it arrogant to tell someone to learn something? I'm not a teacher. I'm not here to hold your hand. I'm not here to go "ok this line does this, and this line does this because blah." I'm here to help with thought provoking questions. I'm here for free, on my own spare time, answering the questions I choose to answer. I'll respond how ever the hell I want (until a mod/admin tells me to shut my mouth ;p). I have been wrong before. I have crossed the line before (in hind sight). I've stuck my foot in my mouth tons of times on here, but I stand by my "you should learn PHP/MySQL" question. You didn't even try to answer your own question. You were using a code generator for God's sake. If that doesn't warrant telling you to learn the language, what does? Would I Google translate things into Spanish and then ask someone how to say something? That doesn't make sense if I'm trying to learn the language. Also, you said the code generator thing like it validated your hostility towards my suggestion to learn the basics. No it doesn't. If I didn't do my homework correctly, and I asked a teacher how to do a problem without even trying, wouldn't he tell me to try to learn it? "But a program did my homework for me!!!!" What makes you think you can come in here with your code generator knowledge and think that you know everything? That you can declare me arrogant because I told you to learn? What makes you think you're special? What makes you think you're worth my time? People like you are what make me want to leave PHPFreaks. God. Edit: I don't plan on leaving anytime soon, to anyone who reads this and would actually care if I left. Quote Link to comment https://forums.phpfreaks.com/topic/131548-how-to-display-all-records-by-echo-in-php/#findComment-683336 Share on other sites More sharing options...
aldrin151 Posted November 7, 2008 Author Share Posted November 7, 2008 Listen Corbin...I got you wrong and I guess you misunderstood me also...I really appreciate the help...seriously...I was having a bad day and got all screwed up. I apologize ... I really like learning from people who know more...also we're on this forum I guess to get support and help one another, "two heads are better than one" especially in stuff like this where you can get so involved in things and have a hard time solving simplest of problems. After all this going back and forth non sense, due to my fault...I learned something...that solution you gave me worked...Thanks very much...your a cool guy. Quote Link to comment https://forums.phpfreaks.com/topic/131548-how-to-display-all-records-by-echo-in-php/#findComment-684295 Share on other sites More sharing options...
corbin Posted November 7, 2008 Share Posted November 7, 2008 Hrmmmmm..... Guess I got kind of grrrr too. Sorry. Glad things worked out. Quote Link to comment https://forums.phpfreaks.com/topic/131548-how-to-display-all-records-by-echo-in-php/#findComment-684313 Share on other sites More sharing options...
legohead6 Posted November 8, 2008 Share Posted November 8, 2008 the thing you have to understand with php is so many things can cause 1 problem, so you may have to do a bit of trial and error to figure things out corbin's first response was one of the more obvious things that may be wrong. but hes not guaranteeing that is the only problem... PHP takes a lot of Patience and perseverance Quote Link to comment https://forums.phpfreaks.com/topic/131548-how-to-display-all-records-by-echo-in-php/#findComment-685528 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.