182x Posted November 17, 2006 Share Posted November 17, 2006 Hey guys, sorry for all the n00bie questions however this time I am wondering how to display a set of data from a database. For example if the database has 4 columns cId, ty, dId, am and I would like to display all the information in a table where session id = dId. I can create the query but how do you actually display this information?Thanks. Quote Link to comment Share on other sites More sharing options...
danmahoney245 Posted November 17, 2006 Share Posted November 17, 2006 First off no question is a noobie question. Here is what you want:[code]<?php include( "header.php" );$sql = "SELECT * FROM database_name";$query = mysql_query( $sql ); while ( $row = mysql_fetch_array( $sql ) ) { $data = "".$row["data"].""; print "Here is $data<br><br>"; } ?>[/code]Tell me if it works, and good luck!-Dan Quote Link to comment Share on other sites More sharing options...
182x Posted November 17, 2006 Author Share Posted November 17, 2006 Hey thanks for your reply.I have tried the method you have suggested but it turns up the following error:Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in Ne\tr.php on line 11 Quote Link to comment 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.