Click to See Complete Forum and Search --> : javascript and php and Database


mevasquez
02-18-2003, 03:10 PM
I am able to assign the value of a javascript variable to a php variable by doing the following:

var tempID = document.form1.name1.value;
var variable1 = document.form1.name2.value;
var query = "UPDATE tablename set Column1 = '"+variable1+"' where ID = '"+tempID+"'";
<?$ID=tempID?>
<?$var1=variable1?>
<?$q=query?>


I can output the values of $ID and $var and $q by doing the following:

document.write(<?=$ID?>);
document.write("<br>");
document.write(<?=$var1?>);
document.write("<br>");
document.write(<?=q?>);


The above works. The problem is that I want to run a query using mysql_query($q) but nothing happens.

Has anyone had success in being able to access a database. I have tried to include the connection file I use in my normal php file like:


include "dbconnect.php";


Does anyone have any suggestions?

Mike@spb

AdamBrill
02-18-2003, 06:01 PM
Since your question is basically a PHP question, you could try going to http://www.phpbuilder.com/board/