<?
Code: Select all
include("mysql_connect.php");
$id =$_GET['id'];
$sql=mysql_query("SELECT * FROM topics WHERE id='".$id."'");
if($row=mysql_fetch_array($sql))
echo"HI";
else
echo"not i";
mysql_close($con);
?>
i tried the above code to check whether if block which cantains location(header: function is executing or not..but else block execute instead of if echoing
not i..i have 8 files with the same include file
mysql_connect.php
Code: Select all
<?php
$host = "localhost";
$user = "root";
$pass = "";
$db = "ask";
$con=mysql_connect($host,$user,$pass);
mysql_select_db($db,$con);
?>
infact i also have the same type of functionality i am trying to acheive with location.php
i have add_topic.php
Code: Select all
<?php
if (!empty($_POST)) {
$id=$_POST['cat_id'];
include("mysql_connect.php");
if (mysql_query("INSERT INTO topics (title,post,author,mail,date,cat_id,webpage) VALUES ('".$_POST['title']."','".$_POST['post']."','".$_POST['name']."','".$_POST['mail']."','".time()."','".$_POST['cat_id']."','".$_POST['webpage']."')")) {
header("location:topic.php?id=$id");
}
else
{
echo "Error!";
}
mysql_close($con);
}
?>
it work fine
i also have
add_reply.php
Code: Select all
<?php
if (!empty($_POST)) {
include("mysql_connect.php");
if (mysql_query("INSERT INTO replies (topic_id,post,author,mail,date,cat_id) VALUES ('".$_POST['topic_id']."','".$_POST['post']."','".$_POST['name']."','".$_POST['mail']."','".time()."','".$_POST['cat_id']."')"))
{
header("location:show_reply.php?topic_id={$_POST['topic_id']}&cat_id={$_POST['cat_id']}");
} else {
echo "Error!";
}
mysql_close($con);
} else {
echo "Invalid usage!";
}
?>
it also work fine then why not the location work fine which have the same thing like these files
i also ommitted white spces...and there is not a single output occuring before header function still not working and after checking if block which contain header function is not executing