I have moved over sever and is re-doing my layout database, but for some reason its now not working.
When I press on Preview I get errors
Warning: Cannot modify header information - headers already sent by (output started at /home/blarblar/public_html/layouts/preview.php:1) in /home/blarblar/public_html/layouts/preview.php on line 16
Same for when I press download
Warning: Cannot modify header information - headers already sent by (output started at /home/blarblar/public_html/layouts/download.php:1) in /home/blarblar/public_html/layouts/download.php on line 16
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/graficad/public_html/layouts/download.php on line 10
preview.php
Code:
<?php
include ('connection.php');
$id = intval($_GET['id']);
// if you did not rename 'id', leave as 'id'
$q="SELECT * from layouts where id='$id'"; //EDIT 'layouts' to your table name
$result= mysql_query($q) or die
("Could not execute query : $q." . mysql_error());
//Read explanation for further details on this part
while ($row=mysql_fetch_array($result))
{
$id=$row["id"];
$preview=$row["preview"];
$pcounter =$row["pcounter"];
header('Location: '.$preview);
$q="update layouts set pcounter=pcounter+1 where id='$id'"; //EDIT 'layouts','pcounter' again
$result= mysql_query($q) or die
("Could not execute query : $q." . mysql_error());
}
?>
include ('connection.php');
$id = intval($_GET['id']);
// if you did not rename 'id', leave as 'id'
$q="SELECT * from layouts where id='$id'"; //EDIT 'layouts' to your table name
$result= mysql_query($q) or die
("Could not execute query : $q." . mysql_error());
//Read explanation for further details on this part
while ($row=mysql_fetch_array($result))
{
$id=$row["id"];
$preview=$row["preview"];
$pcounter =$row["pcounter"];
header('Location: '.$preview);
$q="update layouts set pcounter=pcounter+1 where id='$id'"; //EDIT 'layouts','pcounter' again
$result= mysql_query($q) or die
("Could not execute query : $q." . mysql_error());
}
?>
download.php
Code:
<?php
include ('connection.php');
$id = intval($_GET['id']);
// if you did not rename 'id', leave as 'id'
$q="SELECT * from layouts where id='$id'"; //EDIT 'layouts' to your table name
$result= mysql_query($q) or die
("Could not execute query : $q." . mysql_error());
//Read explanation for further details on this part
while ($row=mysql_fetch_array($result))
{
$id=$row["id"];
$download=$row["download"];
$dcounter =$row["dcounter"];
header('Location: '.$download);
$q="update layouts set dcounter=dcounter+1 where id='$id'"; //EDIT 'layouts' again
$result= mysql_query($q) or die
("Could not execute query : $q." . mysql_error());
}
?>
include ('connection.php');
$id = intval($_GET['id']);
// if you did not rename 'id', leave as 'id'
$q="SELECT * from layouts where id='$id'"; //EDIT 'layouts' to your table name
$result= mysql_query($q) or die
("Could not execute query : $q." . mysql_error());
//Read explanation for further details on this part
while ($row=mysql_fetch_array($result))
{
$id=$row["id"];
$download=$row["download"];
$dcounter =$row["dcounter"];
header('Location: '.$download);
$q="update layouts set dcounter=dcounter+1 where id='$id'"; //EDIT 'layouts' again
$result= mysql_query($q) or die
("Could not execute query : $q." . mysql_error());
}
?>
The code is still counting, if you can help then I would be very grateful..... I use $id = intval($_GET['id']); as its sql 5 I have also tried $id = $_GET['id'];
Thanks
Joy

