-
Notifications
You must be signed in to change notification settings - Fork 0
/
newtopicajax.php
35 lines (29 loc) · 1 KB
/
newtopicajax.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
require_once('auth.php');
include("connection.php");
$uname=$_POST['usern'];
$newtopic= addslashes($_POST['ntopic']);
$qr="select (category) from topic where category='$newtopic'";
$res=mysql_query($qr);
if($outp=mysql_fetch_row($res))
{
echo "topic already exists";
}
else if($newtopic=="")
{echo"please enter something"; }
else
{savenewtopic($newtopic);}
function savenewtopic($newtopic)
{
$uname=$_POST['usern'];
$qry45="INSERT INTO topic (category,user) VALUES ('$newtopic','$uname')";
$result45=mysql_query($qry45);
if($result45)
{
echo "topic added successfully";
}
else
{
echo "topic not added.";
}}
?>