So I am new to PHP but I have put forth a lot of effort to research my answer before taking it to the community. So far this what I have:

$table = 'vendors';
$sortBy = 'Company/Name';
$query=" SELECT * FROM `$table` WHERE id='$id'";

while ($i < $num) {
	$acct=mysql_result($result,$i,"Account Info");
	$phone=mysql_result($result,$i,"Phone Number");

	<form action="updatePayee.php?id=<?php echo $id; ?>" method="post">
	<input type="hidden" name="ud_id" value="<? echo $id; ?>">
	Company/Name: <input type="text" name="ud_name" value="<? echo $name; ?>"><br>
	Code: <input type="text" name="ud_code" value="<? echo $code; ?>"><br>
	Account Info: <input type="text" name="ud_acct" value="<? echo $acct; ?>"><br>
	Phone Number: <input type="text" name="ud_phone" value="<? echo $phone; ?>"><br>
	Username: <input type="text" name="ud_user" value="<? echo $user; ?>"><br>
	Password: <input type="text" name="ud_pass" value="<? echo $pass; ?>"><br>
	Web Address: <input type="text" name="ud_web" value="<? echo $web; ?>"><br>
	<input type="Submit" value="Update">

Here is the updatePayee.php file that is referenced by the form:


$table = 'vendors';

$ud_query = "UPDATE `$table` SET Company/Name = '$ud_name', Code = '$ud_code', Account Info = '$ud_acct', Phone Number = '$ud_phone', Username = '$ud_user', Password = '$ud_pass', Website = '$ud_web' WHERE id = '$ud_id'" or die(mysql_error());  

$ud_query = mysql_query("SELECT * FROM `$table` WHERE id = '$ud_id'") 
or die(mysql_error());  

$fields_nums = mysql_num_fields($ud_query); // Code, Account Info, Ph#, User, PW, Web, Active
$fieldname = array();
echo "<table>";
for($i=0; $i<$fields_nums; $i++)
	$fields = mysql_fetch_field($ud_query);
	$fieldname[$i] = $fields->name;
echo '<tr><td id="headers">'.implode('</td><td id="headers">',$fieldname).'</td></tr>';

$row = mysql_fetch_array($ud_query);

echo '<div id="updated">Record Updated</div>';
echo '<tr id="data">';
echo '<td>'.$row["Company/Name"].'</td>';
echo '<td>'.$row["Code"].'</td>';
echo '<td>'.$row["Account Info"].'</td>';
echo '<td>'.$row["Phone Number"].'</td>';
echo '<td>'.$row["Username"].'</td>';
echo '<td>'.$row["Password"].'</td>';
echo '<td><a href="'.$row["Website"].'">'.$row["Website"].'</a></td></tr>';
echo '</table>';


For some reason I've gotten the page to say that it updated the file, and to display the result of the edit, the problem is that the entry was not updated at all. I've checked my variables to see what I'm missing but I'm not seeing it. Any help you can provide would mean a lot, so thanks in advance.

my first guess would be a sql error and I am suspicious of your column name "Company/Name". I have never seen this done and am guessing that you may have to escape that "/" so it would be "Company\/Name".

I would try to change the column name in the future to an _ or - to prevent future issues.

you also have some spaces in your column names and would have to surround them with ``.

$ud_query = "UPDATE `$table` SET `Company\/Name` = '$ud_name', Code = '$ud_code', `Account Info` = '$ud_acct', `Phone Number` = '$ud_phone', Username = '$ud_user', Password = '$ud_pass', Website = '$ud_web' WHERE id = '$ud_id'" or die(mysql_error());

you could also try this but my bet is on the first:

$ud_query = "UPDATE `$table` SET `Company//Name` = '$ud_name', Code = '$ud_code', `Account Info` = '$ud_acct', `Phone Number` = '$ud_phone', Username = '$ud_user', Password = '$ud_pass', Website = '$ud_web' WHERE id = '$ud_id'" or die(mysql_error());

or die(mysql_error()) should not be on line 16 but 17

SWEET! So I figured it out. You were on the right track and for future reference I will make a habit of your suggested naming conventions. I went ahead into the phpAdmin and manually made the edit to see the SQL code that got generated from the edit. From this I noticed that the column names had a ` surrounding them so I tried that and it worked. Thanks for the help I'm sure I'll have more questions cause now I have to take my project to the next step.