No one has voted on any posts yet. Votes from other community members are used to determine a member's reputation amongst their peers.
I have an array named &data. I want to create a new array from $data,from x to y position.I tried to make it with for but I don't know how.Pls help.Tnx while($info1=mysql_fetch_assoc($x)) { $data[]= $info1['umiditate']; } for($i=3 ;$i<=5 ;$i++) { $data2=$data[$i]; } |
|
<?php $link=mysql_connect("localhost", "root","parola") or die("Could not connect: " . mysql_error()); mysql_select_db('energiesolara',$link) or die ('Can't use energiesolaradb: ' . mysql_error()); $x=mysql_query("SELECT umiditate FROM parametrii"); while($info=mysql_fetch_array($x)) { $comma_separated=implode(",",$info); } print "$comma_separated"; ?> I want that $comma_separated to store all the elements.But when I print that there is only one element which is … |
|
[CODE]<?php $link=mysql_connect("localhost", "root","parola") or die("Could not connect: " . mysql_error()); print ("Connected successfully");print "</br>"; mysql_select_db('energiesolara',$link) or die ('Can't use energiesolaradb: ' . mysql_error()); $x=mysql_query("SELECT umiditate FROM parametrii"); $y=mysql_query("SELECT temperatura FROM parametrii"); $info1 = mysql_fetch_array($x); $info2 = mysql_fetch_array($y); $xi=array($info1['umiditate']); $yi=array($info2['temperatura']); include('phpgraphlib.php'); $graph=new PHPGraphLib(500,280); $graph->addData($xi,$yi); $graph->setTitle('Grafic'); $graph->setTitleLocation('left'); $graph->setLegend(true); $graph->setLegendTitle('Module-1', 'Module-2'); $graph->setGradient('green', 'olive'); … |