Newbie question: calling a variable
Posted: Sun Aug 24, 2003 12:36 pm
Hi all. I've just started learning php. I've installed everything succesfully using php 4.3.2 on WinXP pro.
Though there's a problem that keeps bugging me. The following code doesn't work:
Then I execute the php with *.php?voted=1
It doesn't do anything this way, but when I put it like this it works:
Does anybody know what I'm doing wrong here or what makes this script fail?
Thank you very much in advance,
Ferdi
Though there's a problem that keeps bugging me. The following code doesn't work:
Code: Select all
while ($row = mysql_fetch_array($numrows))
{
echo "Before action: ".$row[ja];
$ja = $row[ja];
}
$voted = $_POST[voted]; #<- tried it with and without this function
if ($voted == 1)
{
$ja++;
$add = mysql_query ("UPDATE telenamen SET ja = $ja WHERE id = 00001");
echo "<BR> After Action: ".$ja;
if (!add) { echo "Failure"; }
}It doesn't do anything this way, but when I put it like this it works:
Code: Select all
while ($row = mysql_fetch_array($numrows))
{
echo "Before action: ".$row[ja];
$ja = $row[ja];
}
$voted = $_POST[voted];
$voted = 1; # <- I've add this one...
if ($voted == 1)
{
$ja++;
$add = mysql_query ("UPDATE telenamen SET ja = $ja WHERE id = 00001");
echo "<BR> After Action: ".$ja;
if (!add) { echo "Failure"; }
}Thank you very much in advance,
Ferdi