michaelespinosa
08-25-2009, 06:06 PM
I am working on a script to delete photos from a gallery. Basically submit a form to delete.php which grabs the id from the query string and runs the script. Here is delete.php
<?php
require 'database.php';
$id = $_POST['id'];
$q = "DELETE from gallery WHERE id = $id";
$result = $mysqli->query($q) or die("There was a problem!");
if($result) header("location: index.php");
?>
Which when submitted gives me:
Warning: Cannot modify header information - headers already sent by (output started at /nfs/c04/h03/mnt/66004/domains/trifitla.com/html/g_b/database.php:1) in /nfs/c04/h03/mnt/66004/domains/trifitla.com/html/g_b/delete.php on line 11
for reference here is database.php:
<?php
$db_name = "photo_gallery";
$db_server = "localhost";
$db_user = "username";
$db_pass = "password";
$mysqli = new MySQLi($db_server, $db_user, $db_pass, $db_name) or die(mysqli_error());
?>
Any help is appreciated.
<?php
require 'database.php';
$id = $_POST['id'];
$q = "DELETE from gallery WHERE id = $id";
$result = $mysqli->query($q) or die("There was a problem!");
if($result) header("location: index.php");
?>
Which when submitted gives me:
Warning: Cannot modify header information - headers already sent by (output started at /nfs/c04/h03/mnt/66004/domains/trifitla.com/html/g_b/database.php:1) in /nfs/c04/h03/mnt/66004/domains/trifitla.com/html/g_b/delete.php on line 11
for reference here is database.php:
<?php
$db_name = "photo_gallery";
$db_server = "localhost";
$db_user = "username";
$db_pass = "password";
$mysqli = new MySQLi($db_server, $db_user, $db_pass, $db_name) or die(mysqli_error());
?>
Any help is appreciated.