0
<?php
$title=$_POST["title"];
$theme=$_POST["theme"];
$con=mysql_connect($dbserver,$dbusername,$dbpassword);
if (!$con) { die('Could not connect: ' . mysql_error()); }

mysql_select_db($dbname, $con);
$query=mysql_query("SELECT * FROM setup WHERE id=".$_SESSION['id']);
$result = mysql_query($query);
$num_rows = mysql_num_rows($result);
if ($num_rows > 0)
{
  while($row = mysql_fetch_array($result))
  {
    $_SESSION['id'] = $row['id'];
    $_SESSION['title']=$title['title'];
    $_SESSION['theme']=$theme['theme'];
    }
   {
mysql_query("UPDATE setup  SET title='".$title."' , theme='".$theme."'WHERE id=".$_SESSION['id']);
 header("Location:setup.php?status=1");
    }
}

//else {
    //header("Location:setup.php?status=2");
//}
mysql_close($con);
?>

this is my code for php setup-action and iam having problem for updating values in my sql and i cant understand the error please help :(

the error is on line 10 and 11

Warning: mysql_query() expects parameter 1 to be string, resource given in C:\xampp\htdocs\project\admin\setup-action.php on line 10

Warning: mysql_num_rows() expects parameter 1 to be resource, null given in C:\xampp\htdocs\project\admin\setup-action.php on line 11

Edited by Riu 2009: errors not posted

3
Contributors
5
Replies
12
Views
5 Years
Discussion Span
Last Post by Riu 2009
0

its not repeated i've saved the query in $query and then saved it in $result would u please suggest me how should i do it correctly??
thanks for the rep :)

0

comment line 9 and replace $query with $result,becuase you can't execute query twice ,check this code:

$result=mysql_query("SELECT * FROM setup WHERE id=".$_SESSION['id']);
//$result = mysql_query($query);

excute this ,the error will be disapear.
%%^Murtada^%%

0

thankyou so much the error is gone...but now its saying undefined index on line 2 and 3..

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.