need help in php code

hello sir

I am creating lyrics website. I want to update my category table but update query not working please check problem in code if any


<?php if(isset($_POST["thisID"])==true){ $targetID=$_POST['id']; $date=date("Y/n/d"); $id=$_POST['id']; $category=$_POST['category']; $subcategory=$_POST['subcategory']; $date=$_POST['date']; mysql_connect("localhost","root",""); mysql_select_db("lyrics"); $query= "UPDATE categories SET id='$id', category='$category', subcategory='$subcategory', date='$date' WHERE id='$targetID'"or die(mysql_error()); mysql_query($query); header("refresh:0;url= 'categories.php'"); exit(); } ?> <?php mysql_connect("localhost","root",""); mysql_select_db("lyrics"); if(isset($_GET['pid'])){ $targetID=$_GET['pid']; $date=date("Y/n/d"); $query=mysql_query("SELECT * FROM categories WHERE id='$targetID' LIMIT 1"); $pCount=mysql_num_rows($query); if($pCount>0){ while($row= mysql_fetch_array($query)){ $id=$row["id"]; $category=$row["category"]; $subcategory=$row["subcategory"]; $date=$row["date"]; } }else{ echo "Sorry "; } } ?>
Edit Lyrics
Category-ID
Category <?php echo $category; ?> Hindi Movies Devosional Movies Pop Songs Reginal Songs Album Songs
Subcategory <?php echo $subcategory; ?> Movies Songs Devosional Songs Pop Songs Reginal Songs Album Songs
"/>

Try
[php]<?php
if(isset($_POST[“thisID”])){
$targetID=$_POST[‘id’];
$date=date(“Y/n/d”);
$id=$_POST[‘id’];
$category=$_POST[‘category’];
$subcategory=$_POST[‘subcategory’];
$date=$_POST[‘date’];
mysql_connect(“localhost”,“root”,“password”);

$query= mysql_query(“UPDATE categories SET id=’”.$id."’, category=’".$category."’, subcategory=’".$subcategory."’, date=’".$date."’ WHERE id=’".$targetID."’ ") or die(mysql_error());
header(“Location: categories.php”);
exit();
}
?> [/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service