claro Posted October 18, 2011 Share Posted October 18, 2011 Greetings! I'm planning to place my result in a canvass, queries result are shown during debugging, but I dont know how to put it in php. Is this possible? <?php include "include/z_db.php"; $query1 = mysql_query ("SELECT D.course_Id, COUNT(Status) as STAT FROM tbl_data AS D WHERE D.Status = 'Cleared' AND D.office_Id = 117 GROUP BY course_Id") or die (mysql_error()); ?> <html> <head> <script type="application/javascript" language="javascript"> window.onload = draw; // Execute draw function when DOM is ready function draw() { // Assign our canvas element to a variable var canvas = document.getElementById("canvas1"); // Create the HTML5 context object to enable draw methods var ctx = canvas.getContext("2d"); // Assign font family and pixel size ctx.font = "9pt Arial"; //fillText Parameters ("Text", X, Y); <?php while ($row = mysql_fetch_array ($query1)) { $course = $row['course_Id']; $courses = mysql_query ("SELECT course_Title FROM tbl_course WHERE course_Id = '$course' ") or die (mysql_error()); while ($row2 = mysql_fetch_array ($courses)) { $status = $row['STAT']; $course = $row2['course_Title']; //fillText Parameters ("Text", X, Y); echo "ctx.fillText(".$course.", 10, 20); "; //fillStyle Parameters (r, g, b, alpha); echo "ctx.fillStyle = 'rgba(0,200,0,1)'"; //fillRect Parameters (X, Y, width, height); echo "ctx.fillRect (36, 10, ".$status.", 12);"; } } ?> } </script> </head> <body> <canvas id="canvas1" width="200" height="110"></canvas> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/249312-php-in-html-5-canvass-and-js/ Share on other sites More sharing options...
trq Posted October 18, 2011 Share Posted October 18, 2011 Of course it's possible. Describe your actual problem. Quote Link to comment https://forums.phpfreaks.com/topic/249312-php-in-html-5-canvass-and-js/#findComment-1280171 Share on other sites More sharing options...
claro Posted October 18, 2011 Author Share Posted October 18, 2011 that's it, I want to show those data. But it shows nothing. that is my actual code. Quote Link to comment https://forums.phpfreaks.com/topic/249312-php-in-html-5-canvass-and-js/#findComment-1280180 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.