03-15-10, 09:50 PM
New Member
Join Date: Mar 2010
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Problem updating a MySQL table using PHP
Recently, I switched from MySQL 5.0 to 5.1.30 and have encountered problems when I try to update a form. For some reason, using MySQL 5.1.30, only a limited amount of data will update where as before, I could basically put a huge amount of data in the form and it would save all the data. If there is too much data put into the form, after pressing the submit button, the form will revert to the same old data and never update. I searched the internet and thought maybe it was because there is now an information_schema table listed also under phpMyadmin. I have listed the php page that is giving me the issue below.
PHP Code:
<?
if( $act == 'chset' )
{
mysql_query ( "UPDATE design SET value=' $homepage ' WHERE name='homepage'" );
mysql_query ( "UPDATE design SET value=' $faq ' WHERE name='faq'" );
mysql_query ( "UPDATE design SET value=' $terms ' WHERE name='terms'" );
mysql_query ( "UPDATE design SET value=' $homeright ' WHERE name='homeright'" );
mysql_query ( "UPDATE design SET value=' $pagebg ' WHERE name='pagebg'" );
mysql_query ( "UPDATE design SET value=' $h2_style ' WHERE name='h2_style'" );
mysql_query ( "UPDATE design SET value=' $body_style ' WHERE name='body_style'" );
mysql_query ( "UPDATE design SET value=' $gmpage ' WHERE name='gmpage'" );
}
?>
<? $c_result = mysql_query ( "select name, comments, value from design where name='homepage'" );
$c_row = mysql_fetch_row ( $c_result );
?>
<form name="form1" method="post" action="">
<table width="100%" border="0">
<tr>
<td colspan="2" bgcolor="#193394"><b><font color="#ffc211" face="Arial, Helvetica, sans-serif" size="2">DESIGN
AND CONTENT SETTINGS</font></b></td>
</tr>
<tr>
<td colspan="2">
<hr noshade size="1">
</td>
</tr>
<tr valign="top">
<td width="28%" align="right">
<? echo $c_row [ 1 ] ?>
</td>
<td width="72%">
<? echo "<textarea name=homepage cols=60 rows=8> $c_row [ 2 ] </textarea>" ?>
</td>
</tr>
<tr valign="top">
<td colspan="2" align="right">
<hr noshade size="1">
</td>
</tr>
<tr valign="top">
<? $c_result = mysql_query ( "select name, comments, value from design where name='faq'" );
$c_row = mysql_fetch_row ( $c_result );
?>
<td width="28%" align="right">
<? echo $c_row [ 1 ] ?>
</td>
<td width="72%">
<? echo "<textarea name=faq cols=50 rows=8> $c_row [ 2 ] </textarea>" ?>
</td>
</tr>
<tr valign="top">
<td colspan="2" align="right">
<hr noshade size="1">
</td>
</tr>
<tr valign="top">
<? $c_result = mysql_query ( "select name, comments, value from design where name='terms'" );
$c_row = mysql_fetch_row ( $c_result );
?>
<td width="28%" align="right">
<? echo $c_row [ 1 ] ?>
</td>
<td width="72%">
<? echo "<textarea name=terms cols=50 rows=8> $c_row [ 2 ] </textarea>" ?>
</td>
</tr>
<tr valign="top">
<td colspan="2" align="right">
<hr noshade size="1">
</td>
</tr>
<tr valign="top"> <? $c_result = mysql_query ( "select name, comments, value from design where name='gmpage'" );
$c_row = mysql_fetch_row ( $c_result );
?>
<td width="28%" align="right">
<? echo $c_row [ 1 ] ?>
</td>
<td width="72%">
<? echo "<textarea name=gmpage cols=50 rows=8> $c_row [ 2 ] </textarea>" ?>
</td>
</tr>
<tr valign="top">
<td colspan="2" align="right">
<hr noshade size="1">
</td>
</tr>
<tr valign="top">
<? $c_result = mysql_query ( "select name, comments, value from design where name='homeright'" );
$c_row = mysql_fetch_row ( $c_result );
?>
<td width="28%" align="right">
<? echo $c_row [ 1 ] ?>
</td>
<td width="72%">
<? echo "<textarea name=homeright cols=50 rows=8> $c_row [ 2 ] </textarea>" ?>
</td>
</tr>
<tr valign="top">
<td colspan="2" align="right">
<hr noshade size="1">
</td>
</tr>
<tr valign="top">
<? $c_result = mysql_query ( "select name, comments, value from design where name='pagebg'" );
$c_row = mysql_fetch_row ( $c_result );
?>
<td width="28%" align="right">
<? echo $c_row [ 1 ] ?>
</td>
<td width="72%">
<? echo "<input type=text name=pagebg value=' $c_row [ 2 ] '" ?>
</td>
</tr>
<tr valign="top">
<td colspan="2" align="right">
<hr noshade size="1">
</td>
</tr>
<tr valign="top">
<? $c_result = mysql_query ( "select name, comments, value from design where name='h2_style'" );
$c_row = mysql_fetch_row ( $c_result );
?>
<td width="28%" align="right">
<? echo $c_row [ 1 ] ?>
</td>
<td width="72%">
<? echo "<textarea name=h2_style cols=50 rows=5> $c_row [ 2 ] </textarea>" ?>
</td>
</tr>
<tr valign="top">
<? $c_result = mysql_query ( "select name, comments, value from design where name='body_style'" );
$c_row = mysql_fetch_row ( $c_result );
?>
<td colspan="2" align="right">
<hr noshade size="1">
</td>
</tr>
<tr valign="top">
<td width="28%" align="right">
<? echo $c_row [ 1 ] ?>
</td>
<td width="72%">
<? echo "<textarea name=body_style cols=50 rows=5> $c_row [ 2 ] </textarea>" ?>
</td>
</tr>
<tr valign="top">
<td width="28%" align="right"> </td>
<td width="72%"> </td>
</tr>
<tr valign="top">
<td width="28%" align="right"> </td>
<td width="72%"> </td>
</tr>
<tr valign="top">
<td width="28%" align="right"> </td>
<td width="72%"> </td>
</tr>
<tr valign="top">
<td width="28%" align="right"> </td>
<td width="72%"> </td>
</tr>
<tr valign="top">
<td width="28%" align="right">
<input type="hidden" name="tp" value="setdesign">
<input type="hidden" name="act" value="chset">
</td>
<td width="72%"> </td>
</tr>
<tr valign="top">
<td colspan="2" align="right">
<div align="center">
<input type="submit" name="Submit" value="Change settings">
</div>
</td>
</tr>
</table>
</form>
Last edited by wirehopper; 03-16-10 at 07:07 AM .
Reason: PHP tags