472,790 Members | 3,536 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,790 software developers and data experts.

Discussion about updationof records in php

Hello friends,
I am working in php .i have one problem regarding to updation .
Code for updation i use is :
<?php
$fname = $_POST['fname'];
$lname = $_POST['lastname'];
$find = $_POST['age'];
echo "$find"; ?>
<table width="200" border="0" cellpadding="0" cellspacing="0" bordercolor="#666666" bgcolor="#FFFFFF"/>
<tr bordercolor="#666666" bgcolor="#99FFCC">
<td bordercolor="#333333" border ="1"><?php
$host="localhost"; // Host name
$username="root"; // Mysql username
$password="root"; // Mysql password
$db_name="projectdb"; // Database name
// Connect to server and updatedatabase.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
$sqls ="UPDATE person SET Age = '$find'
WHERE FirstName = '$lname ' AND LastName = '$fname'";
$result = mysql_query($sqls);
if($result == '1')
echo"Record updated suceefully";
else
echo"sorry";
?>
It is not showing error but records are not updated.
Please suggest me.As I am beginners.So please suggest me.
Jul 20 '07 #1
2 1034
abertay
10
Hello friends,
I am working in php .i have one problem regarding to updation .
Code for updation i use is :
<?php
$fname = $_POST['fname'];
$lname = $_POST['lastname'];
$find = $_POST['age'];
echo "$find"; ?>
<table width="200" border="0" cellpadding="0" cellspacing="0" bordercolor="#666666" bgcolor="#FFFFFF"/>
<tr bordercolor="#666666" bgcolor="#99FFCC">
<td bordercolor="#333333" border ="1"><?php
$host="localhost"; // Host name
$username="root"; // Mysql username
$password="root"; // Mysql password
$db_name="projectdb"; // Database name
// Connect to server and updatedatabase.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
$sqls ="UPDATE person SET Age = '$find'
WHERE FirstName = '$lname ' AND LastName = '$fname'";
$result = mysql_query($sqls);
if($result == '1')
echo"Record updated suceefully";
else
echo"sorry";
?>
It is not showing error but records are not updated.
Please suggest me.As I am beginners.So please suggest me.

Hi punitshrivastava,
i've gone through your code....

replace this query
$dbconnection=mysql_connect($host,$username,$passw ord) or die("cannot connect");

and also
$result = mysql_query($sqls,$dbconnection);

if you still can't get the desired result try to echo every sql statement.
Jul 20 '07 #2
Hi abertay,
Thanks it works.

Hi punitshrivastava,
i've gone through your code....

replace this query
$dbconnection=mysql_connect($host,$username,$passw ord) or die("cannot connect");

and also
$result = mysql_query($sqls,$dbconnection);

if you still can't get the desired result try to echo every sql statement.
Jul 20 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

13
by: Robert Smith | last post by:
I'm doing a website development course and during an exercise my teacher gave me to do at home I was confronted with errors. Surprisingly, those that did the exercise in class did not receive...
5
by: stenknz | last post by:
Does any one know where there is a good introduction to Discussion Forum scripting using PHP and MySQL. (Apache WS) I just need the nuts and bolts to get an overview of whats required. Regards,...
21
by: Rune Steffensen | last post by:
I've been lurking c.l.p for a while now, and find the amount of messages a bit annoying. To solve this, I suggest the creation of the new group "comp.lang.pyhon.discussions". So when people post...
11
by: BillCo | last post by:
I'm using a backend that's been around for years before I joined the company. It kind of grew exponentially and has some design problems including large unused tables some temporary tables. It...
3
by: John Rivers | last post by:
Hello, I think this will apply to alot of web applications: users want the ability to delete a record in table x this record is related to records in other tables and those to others in...
66
by: Cor | last post by:
Hi, I start a new thread about a discussion from yesterday (or for some of us this morning). It was a not so nice discussion about dynamically removing controls from a panel or what ever. It...
0
by: Harry Smith | last post by:
This was posted in news.groups, but it was not posted to the list. REQUEST FOR DISCUSSION (RFD) unmoderated group comp.databases.postgresql.admin unmoderated group...
1
by: | last post by:
I use a variety of controls made by a variety of vendors, including Microsoft. In general the level of development on gridview-like presentational controls is very impressive. Telerik, Inc's...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.