Get support from Xavier Media
It is currently Sun Dec 08, 2013 12:25 pm

All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: UPdating
PostPosted: Fri Feb 01, 2008 4:00 pm 

Points:
Ok, i'm trying to update in the same page but it either comes through as an array or updates one and the rest at the same time.

Can you help?

Here is the code:


<?php



if(isset($_POST['textid']))
{
$id = $_POST['textid'];
$n = count($id);
$i = 0;
$text = $_POST['text'];
echo $text;


while ($i < $n)
{
$ei = "{$id[$i]}";
$i++;
mysql_query ("UPDATE textinput SET text = '$text' WHERE textid = '{$ei}'");





}

}


$result = mysql_query("SELECT * FROM textinput");

echo "<table border='1'><form action='edit.php' method='post'>";

while($row = mysql_fetch_array($result))
{

echo "<tr>";
echo "<td>" . $row['textid'] . "</td>";
echo "<td>";
echo "<input type='text' name='text' value='" . $row['text'] . "'>";
echo "</td>";
echo "<td>";
echo "<input type='hidden' name='textid' value='" . $row['textid'] . "'>";
echo "<td>";
echo "</tr>";
};

echo "<tr>";
echo "<td>";
echo "<input name='send' type='submit' value='EDIT!'>";
echo "</td>";
echo "</tr>";
echo "</form></table>";

?>

</body>
</html>


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: Sun Feb 03, 2008 4:06 pm 

Points:
I have never used {} in my arrays I have always used $v[i] instead so I have some problems seeing exactly what's wrong with your code.

/Andreas


Report this post
Top
  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Registered users: No registered users


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Portal » Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
[
SEO MOD © 2007 StarTrekGuide ]