TheCatapult Posted March 22, 2012 Report Share Posted March 22, 2012 (edited) Bros, I would like to thank you for your help in my PHP. It worked now. But I am having problem displaying the data in database. Here's the code. <?php$username="";$password="";$database="";mysql_connect("",$username,$password);@mysql_select_db($database) or die( "Unable to select database");$query="SELECT * FROM top10";$result=mysql_query($query);$num=mysql_numrows($result);mysql_close();$i=0;while ($i < $num) {$top10=mysql_result($result,$i,"one", "two" , "three", "four", "five", "six", "seven" , "eight", "nine", "ten");echo "$top10";$i++;}?> Thanks! Please help. Edited March 22, 2012 by MisterCatapult Link to comment Share on other sites More sharing options...
justsomeguy Posted March 22, 2012 Report Share Posted March 22, 2012 Check the manual for mysql_result, it has 2 required parameters and 1 optional parameter. You're trying to send it 12 parameters. http://www.php.net/manual/en/function.mysql-result.php You may want to use this instead, check the examples: http://www.php.net/manual/en/function.mysql-fetch-assoc.php Link to comment Share on other sites More sharing options...
TheCatapult Posted March 22, 2012 Author Report Share Posted March 22, 2012 Thank you, brother! It worked but it displays continually. I mean each row does not display in a separate line.Like 12345678910 which is supposed to be12345678910. Please help me. Thanks! Link to comment Share on other sites More sharing options...
Ingolme Posted March 22, 2012 Report Share Posted March 22, 2012 Try echoing a line break or <br> element: echo '<br>';echo "\n"; Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now