Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
| Search | Today's Posts | Mark Forums Read
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old January 12th, 2010, 12:26 PM
Registered User
 
Join Date: Dec 2009
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default calling a php function to access a MySQL database from javascript

i am mixing javascript and php to graph sales dynamically from a mysql database - unfortunately i can only plot 1st sales value - i basically need javascript to call a php function that queries the database and returns the next sales value - here is a snippet from the php file

$x=0;
echo "
function loop() {
ctx.clearRect(0, 0, canvas.width, canvas.height);";

$qt=mysql_query("select sales from gd_graph");
$y = mysql_result($qt, $x);
$x+=1;

echo "
yy_prev=yy;
yy=" . $y .";\n";

echo "
for(var i = 0; i < NUM_PARTICLES; i++) {
particles[i].update();

ctx.moveTo(particles[i].x, yy);
ctx.lineTo(particles[i].x - particles[i].xvel, yy_prev);
ctx.stroke();
ctx.closePath();
}
setTimeout(loop, 1000);
}

any ideas much appreciated

cheers

Abbey


Similar Threads
Thread Thread Starter Forum Replies Last Post
Calling VBScript Function from javascript arnabghosh Classic ASP Professional 1 July 13th, 2007 08:32 AM
Calling javascript function from with in ASP kawal.singh Classic ASP Basics 1 July 4th, 2007 05:17 AM
Calling a javascript function from C# SebFr C# 0 November 3rd, 2006 12:05 PM
Calling a .NET function from javascript jainnid General .NET 6 June 8th, 2005 04:54 AM
On calling javascript function only one value pops shoakat Classic ASP Components 4 April 24th, 2005 06:07 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.