Update problem to mySQL with PHP please help

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
vohyndra
Forum Newbie
Posts: 2
Joined: Tue May 13, 2008 9:24 am

Update problem to mySQL with PHP please help

Post 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
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Re: Update problem to mySQL with PHP please help

Post by Benjamin »

You'll get more answers if you use the code tags.
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: Update problem to mySQL with PHP please help

Post 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).
Post Reply