hey thanx a lot, got it, my mistake
Printable View
hey thanx a lot, got it, my mistake
again there is an error when i going t update an row, please show me the mistake..
if (isset($_REQUEST['id']) && GUID::isGUID($_REQUEST['id'])){
$queryStr2="SELECT * FROM project WHERE PROJECT_ID='".$_REQUEST['id']."'";
$query2=mysql_query($queryStr2);
$row=mysql_fetch_array($query2);
$queryStr="UPDATE project SET";
$queryStr.=" PROJECT_TITLE = '".mysql_real_escape_string($ROJECT_TITLE)."'";
$queryStr.=",PROJECT_LOCATION = '".mysql_real_escape_string($ROJECT_LOCATION)."'";
$queryStr.=", PROJECT_TIME_UPDATED = '".$PROJECT_TIME_UPDATED."'";
//$queryStr.=" PROJECT_STATUS = '".mysql_real_escape_string($_REQUEST['status'])."'";
$queryStr.=", PROJECT_STATUS = '".mysql_real_escape_string($PROJECT_STATUS)."'";
//$queryStr.mysql_real_escape_string($PROJECT_STATUS);
$queryStr.=" WHERE PROJECT_ID='".$_REQUEST['id']."'";
}else{
$queryStr="INSERT INTO project (";
Is it inserting instead of updating, or just failing completely?
yeh it is inserting instead of updating
waiting for ur reply
waiting for the reply
hi, i am new to php and my sql, i want to retrieve the value of radiobutton from mysql using php and i cant figure out the problem please check my code and tell me where iam wrong and what is the right way to solve this problem, thank you
<?php include("../includes/config.php"); ?>
<?php
if ($_SESSION["isadmin"])
{
$con=mysql_connect($dbserver,$dbusername,$dbpassword);
if (!$con) { die('Could not connect: ' . mysql_error()); }
mysql_select_db($dbname, $con);
$accountid=$_GET["id"];
$result = mysql_query("SELECT * FROM accounts WHERE (id='".$accountid."')");
while($row = mysql_fetch_array($result))
{
$id=$row['id'];
$firstname = $row['firstname'];
$lastname = $row['lastname'];
$email=$row['email'];
$type=$row['type'];
}
mysql_close($con);
?>
<!DOCTYPE HTML>
<html>
<head>
<title>Edit User</title>
<link rel="StyleSheet" href="../admin/css/style.css" type="text/css" media="screen">
</head>
<body>
<?php include("../admin/includes/header.php"); ?>
<?php include("../admin/includes/nav.php"); ?>
<?php include("../admin/includes/manage-users-aside.php"); ?>
<div id="maincontent">
<div id="breadcrumbs">
<a href="">Home</a> >
<a href="">Manage Users</a> >
<a href="">List Users</a> >
Edit User
</div>
<h2>Edit User</h2>
<form method="post" action="users-edit-action.php">
<input type="hidden" value="<?php echo $accountid; ?>" name="id" />
<label>Email/Username:</label><input type="text" name="email" value="<?php echo $email; ?>" /><br /><br />
<label>Password:</label><input type="password" name="password" value="<?php echo $password;?>" /><br /><br />
<label>First Name:</label><input type="text" name="firstname" value="<?php echo $firstname; ?>" /><br /><br />
<label>Last Name:</label><input type="text" name="lastname" value="<?php echo $lastname; ?>" /><br /><br />
<label>Type:</label><br />
<input type="radio" name="type" value="Student""<?php echo $type;?>" /> Student<br />
<input type="radio" name="type" value="Teacher""<?php echo $type; ?>" /> Teacher<br />
<input type="submit" value="Edit" />
</form>
</div>
</body>
<?php include("../admin/includes/footer.php"); ?>
</html>
<?php
}
else
{
header("Location: ".$fullpath."login/unauthorized.php");
}
?>
this is my code for editing the values in database using php.. please help
You need to read my previous posts in this thread, as they deal with the exact issue.
In summary, "radio buttons" are not a MySQL data type, they are an HTML construct.
You need to evaluate " type" so that your code selects the correct radio button.
One of your radio buttons will then look like this:
<input type="radio" name="type" value="whatever" checked>Whatever
The trick is to assign "checked" to the right button.
All the help you need with this is already here in the thread.
hi
this thread while, is a few months old, helped greatly with what i'm trying to do for class but i'm now trying to extract the value that was entered into the database from the radio buttons and place in a table
Attachment 15361 i'd like it to replace the N C D with a image but also place them in the apporpriate column as well
below is the code for the above pic that i currently have
any help and ideas welcome
thanks
daryl
<?php
include("../scripts/db_connect.php");
$query ="select * from units";
if ($result = mysql_query($query,$conn)){
$rows= mysql_numrows($result);
?>
<table width="642" border="1" cellpadding="5">
<tr>
<td width="82" >Unit Code</td>
<td width="204">Unit Name</td>
<td width="80">Next</td>
<td width="80">Current</td>
<td width="80">Done</td>
</tr>
<?php
$i=0;
while($i<$rows){
$recordArray=mysql_fetch_array($result);
echo"<tr><td>$recordArray[1]</td>
<td>$recordArray[2]</td>
<td>$recordArray[3]</td>
<td>$recordArray[3]</td>
<td>$recordArray[3]</td>
</tr>";
$i++;
}
}else{
echo"something went wrong. MySQL reports: <b>",mysql_error(),"</b>";
}
?>
</table>
<?php
mysql_close($conn);
?>