my code is:
[code=php]
<?php
error_reporting (E_ALL);
ini_set('displa y_errors', True);
include("db.php ");
$table = 'sondaje';
$pollPick = $_POST['pollPick'];
mysql_pconnect( $host, $user, $pass);
mysql_select_db ($database);
if ($pollPick != NULL ) {
$query = "SELECT * FROM $table WHERE pollField = '$pollPick'";
$result = mysql_query($qu ery);
$num = mysql_num_rows( $result);
if ($num > 0 ) { // if variable is ever greater than 0, we update the pollfield or insert a new one
$query = "UPDATE $table SET pollCounter+1 WHERE pollField = '$pollPick' " ;
mysql_query($qu ery) or die ("Couldn't Update table");
} else { // if sum equals zero, then we will create a new row with the pollPick as the field name
$query = "INSERT INTO $table VALUES ( '$pollPick', 1, '' )";
mysql_query($qu ery) or die ("Couldn't insert new pollField into the table");
}
}
//$query = "INSERT INTO $table VALUES ( '$pollPick', 1, '' )";
//mysql_query($qu ery) or die ("Couldn't insert new pollField into the table");
?>
[/code]
The error message is:
I really checked the spelling. Am I missing something? Thanks!
[code=php]
<?php
error_reporting (E_ALL);
ini_set('displa y_errors', True);
include("db.php ");
$table = 'sondaje';
$pollPick = $_POST['pollPick'];
mysql_pconnect( $host, $user, $pass);
mysql_select_db ($database);
if ($pollPick != NULL ) {
$query = "SELECT * FROM $table WHERE pollField = '$pollPick'";
$result = mysql_query($qu ery);
$num = mysql_num_rows( $result);
if ($num > 0 ) { // if variable is ever greater than 0, we update the pollfield or insert a new one
$query = "UPDATE $table SET pollCounter+1 WHERE pollField = '$pollPick' " ;
mysql_query($qu ery) or die ("Couldn't Update table");
} else { // if sum equals zero, then we will create a new row with the pollPick as the field name
$query = "INSERT INTO $table VALUES ( '$pollPick', 1, '' )";
mysql_query($qu ery) or die ("Couldn't insert new pollField into the table");
}
}
//$query = "INSERT INTO $table VALUES ( '$pollPick', 1, '' )";
//mysql_query($qu ery) or die ("Couldn't insert new pollField into the table");
?>
[/code]
The error message is:
Code:
Notice: Undefined index: pollPick in /home/***********/polls.php on line 10
Comment