Hello all

I am creating a page that dynamically updates as tables are added and removed from the database.

Like so:

#connect to mysql
$conn = @mysql_connect("localhost", "root", "*****")  
	                or die("Err:Conn");

#select db
$rs = @mysql_select_db("ecf_training", $conn)  
		or die("Err:Db");
$query="SELECT * FROM class";
if($num != 0){
     echo("<table class = 'courses' border = '1' BORDERCOLOR = 'black' cellpadding='0' cellspacing='0'> 
		<tr class = 'black'>

	while ($i < $num) {

And that works beautifully.

But I would like to add another column in the table that will echo the number of registered users in each class.

I know the code to get that done; however, I don't know how to access each class indivually.

Any ideas?

Thanks in advance :)


9 Years
Discussion Span
Last Post by littletechie

Sorry, I forgot to include that.

When the table is created, two queries are executed.

$result="INSERT INTO ecf_training.class(table_name, date, type, time)
	VALUES(\"$class\", \"$date\", \"$type\", \"$time\")";

$result2="CREATE TABLE ecf_training.`$class` (`FirstName` TEXT NOT NULL, `LastName` TEXT NOT NULL, `address` TEXT NOT NULL, `city` TEXT NOT NULL, `state` TEXT NOT NULL, `zip` TEXT NOT NULL,`phone` TEXT NOT NULL, `email` TEXT NOT NULL,`role` TEXT NOT NULL) 					     ENGINE = MyISAM";

#execute query
	$rs = mysql_query($result, $conn)
		or die ("Err:Query1");
	$rs2 = mysql_query($result2, $conn)

So it inserts the class information (date, time, etc) in the class table, while also creating a new table for the user's information.

And I'm looking to echo the current number of registered user's for each individual class.

Hope this helps,


This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.