PHP and Javascript
| From: | Darren Paxton | Date: | Tue, 05 Sep 2000 12:48:54 +0000 |
| Subject: | PHP and Javascript | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-15288@lists.php.net to get a copy of this message | ||
Hello,
I am currently attempting to integrate a javascript authentication procedure with some variables
pulled from a MySQL database using PHP. The problem I am encountering is that once the first value
is pulled, then that value seems to be set for the duration. I have even attempted to restart all of
my httpd processes and the MySQL server, but the variable still seems to be set.
These are the lines of code I am attempting to incorporate
<?php
$query = "select capacity from mrbs_room where id=$room_id ";
$people = mysql_query($query); <- this is supposed to pull a value for a capacity of a room
echo mysql_error();
?>
This is the javascript I have tried to use for validation, (I would consider using server-side
validation, but for the fact that I have inherited this system and all of the other validation is
done using javascript and client side.
people = parseInt(document.forms["main"].people.value);
if( people > <? echo $people ?> )
{
alert("There are too many people\nfor this table.");
return false;
}
What seems to be happening is that the value 2 is being assigned to $people, and this will not
change, even for rooms with capacity of 16. I have verified that the tables are not corrupt by
passing the $query string direct to the mysql command line and it returns the correct value each
time.
If anyone can help me with the syntax or solution to this problem, I would be most grateful
Many Thanks
Darren Paxton