Click here to Skip to main content
15,915,093 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
PHP
function insert()
{
$con=mysql_connect("localhost","root","123");
if(!$con)
{
die('COULD NOT CONNECT'.mysql_error());
}
else
{
mysql_select_db("class",$con);
$cmd=mysql_query("insert into myclass values('$_REQUEST[sname]','$_REQUEST[sage]','$_REQUEST[std]','$_REQUEST[sec]','$_REQUEST[per]')",$con);
}
}
insert();


function delete()
{
$con=mysql_connect("localhost","root","123");
if(!$con)
{
die('COULD NOT CONNECT'.mysql_error());
}
else
{
mysql_select_db("class",$con);
$cmd=mysql_query("delete from myclass where name='$_REQUEST[sname]'",$con);
}
}
delete();


function update()
{
$con=mysql_connect("localhost","root","123");
if(!$con)
{
die('COULD NOT CONNECT'.mysql_error());
}
else
{
mysql_select_db("class",$con);
$cmd=mysql_query("update myclass set per='$_REQUEST[per]' where name='$_REQUEST[sname]'",$con);
}
}
update();
?>
This is my code. But this is not execute the user clicked button enent. It defaultly execute any one of this funtion. it's not working the correct button event...any one help me....
Posted
Updated 15-Mar-12 3:44am
v2

1 solution

Try pussting your variables outside quotes like the example below:


$cmd=mysql_query("update myclass set per= '".$_REQUEST['per']."' where name='".$_REQUEST['sname']."'",$con);
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900