Can someone please tell me whats wrong with this code.

Can someone please tell me whats wrong with this code i keep getting a blank page.
[php]<?php
require_once(“inc/connect.php”);
$sql = “UPDATE scholarship SET sch_downloads = sch_downloads + ‘1’ WHERE sch_id = ‘2013’”;
$results = mysql_query($sql) or die("Error: ". mysql_error(). " with query ". $sql);
if (mysql_affected_rows() == 1) {
header(“Location: pdf/application_2013.pdf”);
exit();
} else {
echo “Something Went Terrible Wrong!”
}
?>[/php]
i have used to queries directly in phpmyadmin and it works. however when i put this code in a file i get a blank page with no errors displayed

thanks in advance

Blank page is not informative at all :slight_smile:

For debugging purpose try to replace redirect (the line with header() function call) to something like this:
[php]echo 'Affected rows: '.mysql_affected_rows();[/php]

Also try to turn on error reporting in your php settings (or in the code):
php.ini

display_errors = On

OR .htaccess

php_flag display_errors On

[php]else {
echo “Something Went Terrible Wrong!”
}[/php]
Thank for your help. The error was with the last piece of code. At the end of the echo statement the semi colon was not present!

Issue resolve. Rah!

Sponsor our Newsletter | Privacy Policy | Terms of Service