Marsha Posted October 30, 2007 Share Posted October 30, 2007 <?php include('dbcreds.php'); echo mysql_result(mysql_query('SELECT title FROM search_data'),0,0);?> I Only get one Line, When really there should be a Whole List! Please help! Quote Link to comment https://forums.phpfreaks.com/topic/75317-solved-can-only-get-one-line-help-plz/ Share on other sites More sharing options...
Marsha Posted October 30, 2007 Author Share Posted October 30, 2007 Guess im not Being that Specific, What I Mean is, When I Enter the Code: <?php include('dbcreds.php'); echo mysql_result(mysql_query('SELECT title FROM search_data'),0,0);?> It only Gives me the Top Row of the Title, When there should be a Load of Rows of Title Quote Link to comment https://forums.phpfreaks.com/topic/75317-solved-can-only-get-one-line-help-plz/#findComment-380948 Share on other sites More sharing options...
kopytko Posted October 30, 2007 Share Posted October 30, 2007 Function mysql_result that you are using accepts 3 arguments. First is resource, second is row, and third is column. In your function there is 0 for row. And thats reason, why you get only one row. Try this: $res = mysql_query('SELECT title FROM search_data'); while($row = mysql_fetch_row($res)) { print_r($row); echo '<br />'; } Quote Link to comment https://forums.phpfreaks.com/topic/75317-solved-can-only-get-one-line-help-plz/#findComment-380960 Share on other sites More sharing options...
Marsha Posted October 30, 2007 Author Share Posted October 30, 2007 Thanks man!!! Works fine now!!! thanks for the quick response Quote Link to comment https://forums.phpfreaks.com/topic/75317-solved-can-only-get-one-line-help-plz/#findComment-380964 Share on other sites More sharing options...
Marsha Posted October 30, 2007 Author Share Posted October 30, 2007 Or not >_< Now theres: Array ( [0] => Before Each of the Rows Quote Link to comment https://forums.phpfreaks.com/topic/75317-solved-can-only-get-one-line-help-plz/#findComment-380968 Share on other sites More sharing options...
Marsha Posted October 30, 2007 Author Share Posted October 30, 2007 bit of help??? anyone? sorry for inpatients Quote Link to comment https://forums.phpfreaks.com/topic/75317-solved-can-only-get-one-line-help-plz/#findComment-380978 Share on other sites More sharing options...
kopytko Posted October 30, 2007 Share Posted October 30, 2007 Could you paste whole your code and output? Perhaps there are empty fields in table? Quote Link to comment https://forums.phpfreaks.com/topic/75317-solved-can-only-get-one-line-help-plz/#findComment-380984 Share on other sites More sharing options...
Marsha Posted October 30, 2007 Author Share Posted October 30, 2007 yah, here the whole page code: <br><br><br><br><br> <center> <img src="testlogo.jpg"><p>Index of Music<br> <form action="results.php" method="post"> Search <input type="text" name="search_text" /> <input type="submit" value="go" /><br> (only accepts alpha-numeric characters with spaces) </form><b> <?php include('dbcreds.php'); echo mysql_result(mysql_query('SELECT count(id)as data FROM search_data'),0,0); ?></b> Songs currently indexed.<br> <p><font color=red>New Bulk File Update!</font><p> <?php include('dbcreds.php');$res = mysql_query('SELECT title FROM search_data'); while($row = mysql_fetch_row($res)) { print_r($row); echo '<br />'; } ?> thats including the script you gave me, then heres a few rows of table: id keyword title link description rank created approved sponsored 2539 Dizzee Dizzee Rascal - Temptation http://www.lo2n.com/DizzeeRascal/DizzeeRascalTempt... Artist: Dizzee Rascal - Song: Temptation 0 2007-10-27 10:09:00 0 0 2535 Dizzee Dizzee Rascal - Stand Up Tall http://www.lo2n.com/DizzeeRascal/DizzeeRascalStand... Artist: Dizzee Rascal - Song: Stand Up Tall 0 2007-10-27 09:50:10 0 0 2536 Dizzee Dizzee Rascal - Dream http://www.lo2n.com/DizzeeRascal/DizzeeRascalDream... Artist: Dizzee Rascal - Song: Dream 0 2007-10-27 10:02:07 0 0 2538 Dizzee Dizzee Rascal - Jezebel http://www.lo2n.com/DizzeeRascal/DizzeeRascalJezeb... Artist: Dizzee Rascal - Song: Jezebel 0 2007-10-27 10:07:30 0 0 2534 Dizzee Dizzee Rascal - Brand New Day http://www.lo2n.com/DizzeeRascal/DizzeeRascalBrand... Artist: Dizzee Rascal - Song: Brand New Day 0 2007-10-27 09:49:04 0 0 Quote Link to comment https://forums.phpfreaks.com/topic/75317-solved-can-only-get-one-line-help-plz/#findComment-380989 Share on other sites More sharing options...
kopytko Posted October 30, 2007 Share Posted October 30, 2007 Remove this line: echo mysql_result(mysql_query('SELECT count(id)as data FROM search_data'),0,0); and try to run script. It should work. Quote Link to comment https://forums.phpfreaks.com/topic/75317-solved-can-only-get-one-line-help-plz/#findComment-380994 Share on other sites More sharing options...
Marsha Posted October 30, 2007 Author Share Posted October 30, 2007 removed it, this is what i got still: Array ( [0] => Dizzee Rascal - Temptation ) Array ( [0] => Dizzee Rascal - Stand Up Tall ) Array ( [0] => Dizzee Rascal - Dream ) Array ( [0] => Dizzee Rascal - Jezebel ) Array ( [0] => Dizzee Rascal - Brand New Day ) Array ( [0] => Dizzee Rascal - Jus' A Rascal ) Array ( [0] => Dizzee Rascal - GO ) Array ( [0] => Dizzee Rascal - Fix Up Look Sharp ) so I Put it back, as it hasnt done anything removing it Quote Link to comment https://forums.phpfreaks.com/topic/75317-solved-can-only-get-one-line-help-plz/#findComment-380995 Share on other sites More sharing options...
rajivgonsalves Posted October 30, 2007 Share Posted October 30, 2007 try this $res = mysql_query('SELECT title FROM search_data'); while($row = mysql_fetch_row($res)) { echo $row[0]."<BR>"; } Quote Link to comment https://forums.phpfreaks.com/topic/75317-solved-can-only-get-one-line-help-plz/#findComment-380997 Share on other sites More sharing options...
Marsha Posted October 30, 2007 Author Share Posted October 30, 2007 Thats done it! thanks very much to you and kopytko thanks! Quote Link to comment https://forums.phpfreaks.com/topic/75317-solved-can-only-get-one-line-help-plz/#findComment-380998 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.