0

I have eight tables with the same schema but containing different data:

`node_a_data` (
`node_a_data_id` int(5) NOT NULL auto_increment,
`timestamp` int(10) NOT NULL default '',
`user_count` int(5) NOT NULL default '0',
PRIMARY KEY (`node_a_data_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=795 ;

The timestamp field just contains a Unix 10 digit timestamp (ie INT(10)) 15 minutes apart for each record in each table, and they will be unique in each table, but only a minute or so apart. What I want to be able to do is group the timestamp records (say in 15 minute segments) and have the user_count summed across the tables for each 'rounded' segment. The PHP code that I have for returning records for an individual table is in the snippet:

<?php require_once('connection/connect.php');
mysql_select_db($database, $connection);

$query = "SELECT * FROM node_d_data";
$result = mysql_query($query, $connection) or die(mysql_error());

while($row = mysql_fetch_assoc($result)){  
  $timestamp =  date('d-m-y H:i',$row['timestamp']);
  $users =  $row['user_count'];
 
  echo "$timestamp;$users\n";
} 

?>

I just want to know how to modify the query so that it returns data as described above from the following tables:

node_a_data
node_b_data
node_c_data
node_d_data
node_e_data
node_f_data
node_i_data
node_j_data


Any help appeciated!

2
Contributors
1
Reply
2
Views
8 Years
Discussion Span
Last Post by marias
0

Azul (hi)
This the whole program for you question.
all what you must change is:
where you find ********* change it with your password of MYSQL
and
@@@@@@ must be change with name of database.
if you have any problem feel free to contact me again.

<?php
echo"we will try connect to the db<br/>\n";

$barak=mysql_connect("localhost","root","*********");



if (!$barak)
	
	{
	die("Fatal Error<br>".mysql_errno()."<br/>".mysql_error() );
	};


echo "you are connect successfully to MYSQL <br/><br/>";

mysql_query("use @@@@@@");



if(mysql_errno() != 0)

	{die("can't change databse");};



echo "Dtabase changed successfully! <br/>\n" ;
$table = mysql_query("SELECT * FROM node_a_data");





			echo "<table border='10'>\n";
			echo"   <tr>
				<tr bgcolor='red'>
				<th>Id</th>
				<th>Timpe</th>
				<th>user</th>
				<tr>";




			while($info=mysql_fetch_array($table,MYSQL_ASSOC))
			{
			//class='red_row'>??????????????????????????????????????????????????????must be inside of first<tr>
			echo 		"<tr> 
					<tr bgcolor='yellow'>
					<td bgcolor='blue'><b>".$info['node_a_id']."<b/></td>".
					"<td>".$info['timestamp']."</td>".
					"<td><a href='mailto:{$info['user_count']}'>".$info['Clie_phone']."</a></td>
					</tr>\n";
					 
			};

			echo "</table>\n";
?>
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.