You are here: Re: QUERY AND UPDATE PROBLEM « PHP Programming Language « IT news, forums, messages
Re: QUERY AND UPDATE PROBLEM

Posted by Lag on 02/27/06 10:41

Thanks for the example.....that makes sense.....if I use a form how do
I get the data, like this? The form is listed first!

<td><form name="edit" method="post" action="updated.php?id=<?php echo
$id; ?>&title=title&datetime=datetime&desc=desc">
<table width="300" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="100" align="left" valign="top">Event Title</td>
<td width="298"><input name="title" type="text" id="title"
value="<? echo $title; ?>" size="30"></td>
</tr>
<tr>
<td width="100">Date &amp; Time</td>
<td><input name="datetime" type="text" id="datetime"
value="<? echo $date; ?>" size="30"></td>
</tr>
<tr>
<td width="100">Description</td>
<td><textarea name="desc" cols="30" rows="5" wrap="VIRTUAL"
id="desc"><? echo $desc; ?></textarea></td>
</tr>
<tr>
<td colspan="2">
<p>&nbsp;</p><p>
<input name="update" type="submit" id="update"
value="Update Event">
</p>
</td>
</tr>
</table>
</form></td>

---------------------updated.php----------------------------

//id, title, datetime, desc are all names of the text fields in the
form on the previous page

$ud_id=$_POST['id'];
$ud_title=$_POST['title'];
$ud_date=$_POST['datetime'];
$ud_desc=$_POST['desc'];
//$ud_web=$_POST['ud_web'];

$query="UPDATE calendar_events SET event_title='$ud_title',
event_start='$ud_date', event_shortdesc='$ud_desc' WHERE id='$ud_id'";
mysql_query($query);
echo "Record Updated";
mysql_close();
?>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация