Page 1 of 1

Update problem to mySQL with PHP please help

Posted: Wed Jul 09, 2008 11:12 am
by vohyndra
i have a problem whit this,.
im sending 2 variables from flash to a php page that has to update some fileds on the data base.
the flash button send this:
on (release) {
numDepto = 201;
torre= "A";
getURL ("clicks.php", "_blank", "POST");
}

and the php page has this script

<?
$torre= $_REQUEST['torre'];
$numDepto = $_REQUEST['numDepto'];
?>


<?php
$con = mysql_connect("marala","xxxxxx","xxxxxx");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}mysql_select_db("my_db", $con);

mysql_query("UPDATE maralaTorres SET clicks=clicks+1 WHERE tower='$torre' AND numDepto = '$numDepto'");
mysql_close($con);
?>

<p><?php echo $_REQUEST['torre']; ?></p>
<p><?php echo $_REQUEST['numDepto']; ?></p>
<p><?php echo $_REQUEST['id']; ?></p>

can any one help me figuring this out what is wrong with my php script that it doesnt update the field on table.

THANKS

Re: Update problem to mySQL with PHP please help

Posted: Wed Jul 09, 2008 3:52 pm
by Benjamin
You'll get more answers if you use the code tags.

Re: Update problem to mySQL with PHP please help

Posted: Wed Jul 09, 2008 7:03 pm
by califdon
I agree with astions, many people who might be able to help you just won't bother when you don't use the [syntax=php]...[/syntax] tags around your code to make it readable. That said, the first thing you need to determine is whether your variables are receiving the values you expect from Flash. To do that, use echo (or print) commands to show you what the variables contain. I would start at the top and see if they even get into the POST variables. If they are what you expect there, then use " or die(mysql_error());" after your mysql_query() command (you should do that routinely, to report MySQL errors).