cliftonbazaar Posted September 17, 2017 Share Posted September 17, 2017 (edited) Hi, If my table is Batman Human 45 Superman Alien 33 How do I display Superman's race and age? Currently I have $sql_statement = "SELECT * FROM heroes"; $toons=mysqli_query($mysql_DB, $sql_statement); while($toons = mysqli_fetch_array($results, MYSQLI_ASSOC)) { echo name; } But this shows all the results where I only want one. Yes I know I could do a "WHERE name = Superman" in the statement but I want the whole table loaded in as I wish to use the other name (Batman) in another part of the program. Please note that this is only a sample data table, the real table is a lot bigger (42k rows so I can't simply do a new sql call each time). Edited September 17, 2017 by cliftonbazaar Quote Link to comment https://forums.phpfreaks.com/topic/305007-getting-a-single-value-from-a-result/ Share on other sites More sharing options...
Jacques1 Posted September 17, 2017 Share Posted September 17, 2017 I have no idea what you're trying to do there. First you want one record, then you want two records, and then you talk about loading 42,000 records all at once, which sounds rather insane. Forget about SQL for now and give us the full picture. What do you want to do with what information? How is the resulting page supposed to look like? Quote Link to comment https://forums.phpfreaks.com/topic/305007-getting-a-single-value-from-a-result/#findComment-1551418 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.