My SQL script isn't working:
$dbHost = '***'; // localhost will be used in most cases
// set these to your mysql database username and password.
$dbUser = '***';
$dbPass = '***';
$dbDatabase = '****'; // the database you put the table into.
$con = mysql_connect($dbHost, $dbUser, $dbPass) or die("Failed to connect to MySQL Server. Error: " . mysql_error());
mysql_select_db($dbDatabase) or die("Failed to connect to database. Error: " . mysql_error());
$username = $_SESSION['username'];
$id = $_POST['id'];
$name = $_GET['name'];
session_start();
if ($_POST['submit']) {
mysql_query("UPDATE project_details SET reported='$username' WHERE name='$id'", $con); //THIS PART DOESN'T WORK
echo "<p>You have reported a planet as inappropriate. That planet will remain invisible until a moderator reviews it.</p>";
} else {
echo "<form method=\"POST\" action=\"report.php\">
<p>Planet Name: <input type=\"text\" value=\"$name\" name=\"id\" readonly=\"readonly\"><br />
<input type=\"submit\" name=\"submit\" value=\"Report\"></p>
</form>";
}It just doesn't run the sql part at the end, but everything else works and no errors ?
Last edited by WindowsExplorer (2011-10-30 10:17:48)
Offline
rookwood101 wrote:
do the other bits within the 'if ($_POST['submit'])' work?
still not working
Offline
WindowsExplorer wrote:
rookwood101 wrote:
do the other bits within the 'if ($_POST['submit'])' work?
still not working
![]()
You didn't answer my question, in the code, you put a comment saying which bit wasn't working, what I'm asking is whether the code after that line works.
Offline
rookwood101 wrote:
WindowsExplorer wrote:
rookwood101 wrote:
do the other bits within the 'if ($_POST['submit'])' work?
still not working
![]()
You didn't answer my question, in the code, you put a comment saying which bit wasn't working, what I'm asking is whether the code after that line works.
I know its only the sql update part because all the other things in the condition POST[submit] works.
Offline
Drop the ', $con' part.
Offline
Magnie wrote:
Drop the ', $con' part.
That should do it. If it doesn't, maybe the SQL's wrong...
Offline