Jump to content

[SOLVED] mysql UPDATE help


adamlacombe

Recommended Posts

I have this code:

<?php

$settings = mysql_query("SELECT * from gb_settings");

$srow = mysql_fetch_object($settings);

if(isset($_POST['submit'])){

$sitename = $_POST['sitename'];
$domain = $_POST['domain'];


		mysql_query('UPDATE gb_settings SET 
					domain="$domain",
					sitename="$sitename" ') or die(mysql_error());
	echo '<div class=\'msg\'>Updated.</div>';
	exit;

}
echo '<form action=\'index.php?go=settings\' method=\'POST\'>
<table align=\'center\' cellpadding=\'5\'>
	<tr>
		<th class=\'header5\' colspan=\'2\'>Settings</th>
	</tr>
		<td class="content5">Site Name:</td>	
		<td class="content5"><input type="text" name="sitename" size="40" value="'; echo $srow->sitename; echo'"></td>
	</tr>
	<tr>
		<td class="content5">Domain:</td>	
		<td class="content5"><input type="text" name="domain" size="40" value="'; echo $srow->domain; echo'"></td>
	</tr>





		<tr>
			<th colspan=\'2\' class=\'header5\'><input type=\'submit\' name=\'submit\' value=\'Change\'></th>
</table>
</form>		
';
?>

everything seems right to me but i dont know.

When I submit the form it says it went through but when i check the database it just inserts " $domain " and " $sitename " instead of what I have in the textareas.

any idea on whats wrong?

Link to comment
https://forums.phpfreaks.com/topic/162404-solved-mysql-update-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.