PHP - * Developing Graphs With Php
Hi all,
I am looking for scripts/tutorials to create a range of simple graphical displays like bar graphs and pie charts. Does anyone know of some good tutorials to get me started? Thanks Similar TutorialsI have some data that I need to have visualized using 2D graphs.
Looking around I see various tools available, in various technology flavors:
JS: Google Charts, Flot, HighCharts
PHP: phpCharts, pCharts, JpGraph
Question I am trying to decide is -- do i want to use JS, or do I want to use PHP.
Can someone please share some insight, provide some ideas, maybe shed some things I didn't think about, to help me consider choosing between these technologies?
EDIT (thoughts): It seems and I think that JS technology is a bit more "polished" when it comes to graphing, and perhaps has a larger following, and perhaps is a bit more "dynamic" than similar packages done in PHP. On the PHP side, JpGraph is not being mantained but other packages are still in a reasonable condision I think. Is that enough to go with JS?
Another area is that JS is client-side only really, so it may be hard to integrate it with anything server-side. aka, it's hard to "call back home" for data for example, so you have to establish all data upfront, when in PHP while on the server side, you can freely call Database as-you-go.
Edited by dennis-fedco, 16 September 2014 - 03:18 PM. HI guys Im developing Health site using PHP and mysql. I want to create graphs from using data in the database on weekly basis. so please tell me what is the best method of creating graphs and charts in php thank in advance How to draw the path of individual planes that avoid the intersection of their paths for safety and optimization of routes?!
Note:
Same number of planes. ( = M )
Same number of coordinates for airports ( junctions ). ( = N )
Add new points to avoid Intersection of paths of the planes!
flights 12 1.JPG 16.44KB
0 downloads
flights 12.JPG 16.08KB
0 downloads
Edited by Vamsi19, 17 September 2014 - 10:57 PM. Hi All,
So phpMyAdmin can generate quite nice graphs, and I was wondering if it is possible to have these graphs pull through into a PHP page?
I would like to develop a classifieds website like olx.in. For that choosing a PHP as language is good or not? Please let me know your suggestions for starting the development. This is the view of the events (basic) Can I do the if/else statement to chose font color base of a MySQL Query Result? (see below) And No matter how I have written this, it will not turn into a scrolling table. I want the headers to stay fixed. I also don't want to rely on Java-most of the staff logs in mobile. I will if I have to though! The other thing I am not seeing how to do, but I know is also possible.... having an "edit event" "view positions" buttons. I am thinking it has to do with storing a variable, but how do you make sure the variables code pulls the event singularly from your query using the Event_ID ?? This is my first site outside of an HTML site. This is the raw synopsis: Building a site that has users with profiles & 6 permission levels. Client & various staffing levels; I use php to code the access because it is not so much about being able to query/change the database-its more so I am handling with php. There is a time log, and keeps up with the pay to the staff and what the client owes per their hours. This is the first layer view once logged in as any staffmember (sans the edit event which is reserved for high perm staff) upon clicking "view positions" they need to be able to request the shift (separate table-please correct me if I am wrong-I have all foreign keys in database in place so making this event table should be along the same as all the others but with diff variables/queries etc. So in theory all I have to do is get the grabbing of the ID field and using it down) Here is my code. Why is it not setting the client named in green? <html> <body> <?php require_once('auth.php'); ?> <?php $sql = "SELECT * FROM Events ORDER BY EventDate DESC LIMIT 40"; $sqlRes = mysql_query($sql); $req1 = mysql_num_rows($sqlRes); $colorpick = $sqlRes['BusinessName'];?> <div class="event_view"> <table border="1" cellspacing="2" cellpadding="2" width="100%" height="100%" bgcolor="silver" style="border-collapse:collapse;"> <tr> <th><font face="Arial, Helvetica, sans-serif" color="black">Event Date</font></th> <th><font face="Arial, Helvetica, sans-serif" color="black">Event Name</font></th> <th><font face="Arial, Helvetica, sans-serif" color="black">Start Time</font></th> <th><font face="Arial, Helvetica, sans-serif" color="black">End Time</font></th> <th><font face="Arial, Helvetica, sans-serif" color="black">Client Name</font></th> </tr> <?php $i=0; while ($i < $req1) { $f1=mysql_result($sqlRes,$i,"EventDate"); $f2=mysql_result($sqlRes,$i,"EventName"); $f3=mysql_result($sqlRes,$i,"Hour"); $f4=mysql_result($sqlRes,$i,"EndHour"); $f5=mysql_result($sqlRes,$i,"BusinessName"); ?> <tr> <td><font face="Arial, Helvetica, sans-serif" color="black"><?php echo $f1; ?></font></td> <td><font face="Arial, Helvetica, sans-serif" color="black"><?php echo $f2; ?></font></td> <td><font face="Arial, Helvetica, sans-serif" color="black"><?php echo $f3; ?></font></td> <td><font face="Arial, Helvetica, sans-serif" color="black"><?php echo $f4; ?></font></td> <td><?php if($colorpick == 'ClientA') { ?> <font face="Arial, Helvetica, sans-serif" color="green"><?php echo $f5; ?></font>; <?php } else($colorpick != 'ClientA'); ?> <font face="Arial, Helvetica, sans-serif" color="black"><?php echo $f5; ?></font></td> </tr> <?php $i++; } ?> </table> </div> </body> </html> Hi guys, I am developing an MVC application and need some advice about how to set up url routing. Currently I can map a uri to modules/controllers and actions. I though I might leave the routing to last but it seems like that might have been a bad idea. Initially I though I might implement a Zend style routing approach and I still want to do this, but I am lost for thoughs on how I might go about this, I have looked at the zend router classes and understand the principle but cant seem to implement it in my own mvc. So far I have this, $router is an instance of a router class. mapRoute takes a route name and a route object as parameters. The name will be used for convinience. The second parameter takes a route instance which currently takes two parameters, where param1 is a route pattern and param2 is deafult values for when a uri macthes the route pattern. So if a user types http://example/user/23, the router should map to user controller, profile action. The id, which is 23, will need to be injected into a request object. Finally the router object will be added to a front controller instance, so the front controller object can gain access to all the routes. Code: [Select] $router->mapRoute("user", new Route( "user/<id>", array( "controller"=>"user", "action"=>"profile" ) ) ); If any one has any ideas please do share, im not after code, unless you want to supply some, I just need some advice to stream line the whole process or what the best way might be. Any help will be greatly appreciated. HI everyone, Here is my code: Code: [Select] $myFile = "newuser.txt"; $fh = fopen($myFile, 'r'); $theData = fread($fh, 55); fclose($fh); $pices=explode(' ', $theData); And it opens up newuser.txt which is: "I love girls LOL 77" The "I Love GIRLS LOL" is the username of the user and the 77 is the id of the user! But when I echo it out like this: Code: [Select] <a href=".?act=Profile&id='.$pices[1].'">'.$pices[0].'</a> It shows only the letter "i"? How do I make it show the full username even if it has spaces? Hi guys, PHP Noobie here. Sorry if I am not using the correct terminology. I am editing a site that was developed in php and all their page.php files are in one folder, the public_html folder. I downloaded the site locally and am using EasyPHP to view changes to the site. My initial problem is, when developing locally, only some of the links work. The following link works. <a class="red" href="benefits.php">Click here</a> The following link does not work. Error 404 <a class="red" href="/placement/">Click here</a> Also, the links in the flash banner do not work... They request this url: http://127.0.0.1:8888/services.php If I type in: http://127.0.0.1:8888/MyCompany/services.php , the browser will then render the page. Finally the scripts cant connect to the database and any user requesting information does not have access. Warning: mysql_query() [function.mysql-query]: Access denied for user ''@'localhost' (using password: NO) in C:\Program Files (x86)\EasyPHP-5.3.6.0\www\MyCompany\placement\index.php on line 108 Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in C:\Program Files (x86)\EasyPHP-5.3.6.0\www\MyCompany\placement\index.php on line 108 Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\Program Files (x86)\EasyPHP-5.3.6.0\www\MyCompany\placement\index.php on line 109 Any Ideas on this problem or and foresight on other problems I may run into... with the database maybe? Hi Everyone !!!! I am working on a project where I want a select form to display information from a MySQL table. The select values will be different sports (basketball,baseball,hockey,football) and the display will be various players from those sports. I have set up so far two tables in MySQL. One is called 'sports' and contains two columns. Once called 'category_id' and that is the primary key and auto increments. The other column is 'sports' and contains the various sports I mentioned. For my select menu I created the following code. <?php #connect to MySQL $conn = @mysql_connect( "localhost","uname","pw") or die( "You did not successfully connect to the DB!" ); #select the specified database $rs = @mysql_SELECT_DB ("test", $conn ) or die ( "Error connecting to the database test!"); ?> <html> <head>Display MySQL</head> <body> <form name="form2" id="form2"action="" > <select name="categoryID"> <?php $sql = "SELECT category_id, sport FROM sports ". "ORDER BY sport"; $rs = mysql_query($sql); while($row = mysql_fetch_array($rs)) { echo "<option value=\"".$row['category_id']."\">".$row['sport']."</option>\n "; } ?> </select> </form> </body> </html> this works great. I also created another table called 'players' which contains the fields 'player_id' which is the primary key and auto increments, category_id' which is the foreign key for the sports table, sport, first_name, last_name. The code I am using the query and display the desired result is as follows <html> <head> <title>Get MySQL Data</title> </head> <body> <?php #connect to MySQL $conn = @mysql_connect( "localhost","uname","pw") or die( "Err:Db" ); #select the specified database $rs = @mysql_SELECT_DB ("test", $conn ) or die ( "Err:Db"); #create the query $sql ="SELECT * FROM sports INNER JOIN players ON sports.category_id = players.category_id WHERE players.sport = 'Basketball'"; #execute the query $rs = mysql_query($sql,$conn); #write the data while( $row = mysql_fetch_array( $rs) ) { echo ("<table border='1'><tr><td>"); echo ("Caetegory ID: " . $row["category_id"] ); echo ("</td>"); echo ("<td>"); echo ( "Sport: " .$row["sport"]); echo ("</td>"); echo ("<td>"); echo ( "first_name: " .$row["first_name"]); echo ("</td>"); echo ("<td>"); echo ( "last_name: " .$row["last_name"]); echo ("</td>"); echo ("</tr></table>"); } ?> </body> </html> this also works fine. All I need to do is tie the two together so that when a particular sport is selected, the query will display below in a table. I know I need to change my WHERE clause to a variable. This is what I need help with. thanks |