Re: Passing variables between html forms and updating sql table

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dear Jason

Here is my original problem below as I am treated as spam. When it
reaches the next page, when the update query is run, it does not update
the database.

Regards

David
Anagram Systems
http://www.anagram-sys.co.uk/ http://www.web-planets.com/davec/techsitedb/

Dear all

I am putting together some pages where I will be able to update mysql
database using php pages. I am having a problem with updating. I put a
record into textboxes and when I press submit it passes the values to the
next page. The problem I am having is updating the values. Here is my
attempt

<?php

  $MySQLLink = mysql_pconnect ("davecp4", "root", "")
   or die("Could not attach to database. Please try later or contact
webmaster@anagram-sys.co.uk");
   mysql_select_db($database_name, $MySQLLink) or die("ERROR--CAN'T CONNECT
TO DB");

   $result = mysql_query("SELECT * FROM ".$table_name) or die("Error: " .
mysql_error());

   for($i = 1; $i < mysql_num_fields($result); $i++)
   {
    $fieldname = mysql_field_name($result, $i);
    $fieldname2 = "$".$fieldname;
    mysql_query("UPDATE $table_name SET $fieldname=$fieldname2 WHERE id
=$id");
    echo $fieldname."<br>".$fieldname2."<br>";
  }


?>

-- Kind Regards David Anagram Systems http://www.anagram-sys.co.uk/
http://www.web-planets.com/davec/techsitedb/




Jason Wong wrote:
> On Wednesday 17 September 2003 22:34, David wrote:
> 
> 
>>I am putting together some pages where I will be able to update mysql
>>database using php pages. I am having a problem with updating. I put a
>>record into textboxes and when I press submit it passes the values to the
>>next page. The problem I am having is updating the values. Here is my
>>attempt
> 
> 
> [snip]
> 
> And can you describe what this problem is? 
> 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux