Update troubles

Codes here !

Moderators: macek, egami, gesf

trompie
New php-forum User
New php-forum User
Posts: 4
Joined: Mon Apr 07, 2003 4:24 am

Update troubles

Postby trompie » Mon Apr 07, 2003 4:38 am

This is the problem: I try to change the original name (originalname, got this from the database) to the modified name (modname). I guess the problem is something with the quotes, but it can as well be something else. Connection with the database is no problem.

thx,
Trompie

modteacher1.php
-------------------------
<form action="modteacher2.php" method=post>
<table>
<tr>
<?
print "<td>This was the original name:</td>
<td><input type=text name=originalname value= '$docents[0]'></td>"
?>
</tr>
<tr>
<td>Name:</td>
<td><input type=text name=modname></td>
</tr>
<tr><td><input type=submit name=Submit value=Submit></td></tr>
</table>
</form>

modteacher2.php
-------------------------

....
<?
$modname = addslashes($modname);
$originalname= addslashes($originalname);

//update database
$query = "update docent set docentname = '$modname' where docentname = '$originalname' ";
$result = mysql_query($query);

if ($result)
print "OK";
else
print "NOK";
?>
...

Romantik
New php-forum User
New php-forum User
Posts: 67
Joined: Mon Feb 24, 2003 2:55 am
Location: ../Ukraine/Kherson
Contact:

Postby Romantik » Mon Apr 07, 2003 9:32 pm

Code: Select all

$modname = addslashes($_POST["modname"]);
$originalname= addslashes($_POST["originalname"]);


trompie
New php-forum User
New php-forum User
Posts: 4
Joined: Mon Apr 07, 2003 4:24 am

Postby trompie » Tue Apr 08, 2003 4:31 am

:oops: Silly me... the user was just not granted to update the tables :oops:

thanx anyway


Return to “mySQL & php coding”

Who is online

Users browsing this forum: Bing [Bot] and 1 guest

cron