I am having a little trouble with some coding that I am trying to do and was wondering if someone can help here is my delima
I have one database table (web_site_info) that consists of one entry with the ID(1) and one FIELD for that ID(1) called info.
When the Admin of the site modifies the page that inserts fields into the database it would consist of the new entry
ID FIELD/ EMPTY VALUE FIELD/ EMPTY VALUE
1 INFO HOMEPAGE
the fields dont exist until the user ads it each field on id(1) will eventually contail html code here is where my problem comes in
I do not know the fields till they are created and I need to dynamically list all fields without knowing the field names except or the id that the fields are contained in.
I want to be able to get a list of the fields and their values so I can parse them to a page to be edited. here is a example of some code I did where the field names are known is there a way to modify this if the field names are not known until they are created to be able to edit the fields
Any help would be appericated
Code: Select all
In the code that I am looking for the values are not known and are created and removed on the fly with another page. I was assuming that you could do the below with a
(select * from website_info where id=1) but I am not sure how to go about the rest
$res = mysql_query("select nondesignerhome,eyeglasseshome,sunglasseshome,special,price,quality,warranty,shipping,payment_methods,how_to_order,contact_info,track_orders,returns_info,faqs,links,terms,homepage,contactlenses,restrictions from website_info where id='1'") or die(mysql_error());
$special= mysql_result($res, 0, "special");
$price= mysql_result($res, 0, "price");
$quality= mysql_result($res, 0, "quality");
$shipping= mysql_result($res, 0, "shipping");
$payment= mysql_result($res, 0, "payment_methods");
$returns= mysql_result($res, 0, "returns_info");
$howto= mysql_result($res, 0, "how_to_order");
$tracking= mysql_result($res, 0, "track_orders");
$contact= mysql_result($res, 0, "contact_info");
$warranty= mysql_result($res, 0, "warranty");
$faqs= mysql_result($res, 0, "faqs");
$links= mysql_result($res, 0, "links");
$terms= mysql_result($res, 0, "terms");
$homepage= mysql_result($res, 0, "homepage");
$contactlenses= mysql_result($res, 0, "contactlenses");
$restrictions= mysql_result($res, 0, "restrictions");
$sunglasseshome= mysql_result($res, 0, "sunglasseshome");
$eyeglasseshome= mysql_result($res, 0, "eyeglasseshome");
$nondesignerhome= mysql_result($res, 0, "nondesignerhome");
echo("
<table>
<tr>
<td></td>
<td width=100% valign=top>
<TABLE align=center class=topic style=\"BACKGROUND: #138b9f\" cellSpacing=1 cellPadding=0 width=\"80%\">
<TBODY>
<TR>
<TH style=\"BACKGROUND: #000000; COLOR: #ffffff\"
colSpan=2>Special Promo Area</TH>
</TR>
<TR>
<TD class=image width=95%>
<span class=\"tRegPriBold\"></span>
<form method=post action=edit_website_info.php?edit=special>
<table border=\"0\" cellpadding=\"3\" cellspacing=\"0\" ID=\"Table6\">
<tr>
<td align=\"right\" width=150>Promo Text:</td>
<td>
<textarea name=special cols=70 rows=20>$special</textarea>
</td>
<tr>
<td align=\"right\" width=150></td>
<td>
<hr>
</td>
</tr>
<tr>
<td align=\"right\"></td>
<td>
<input type=\"submit\" value='Update' size=\"20\"/>
</td>
</tr>
</table></table>
</TD></form>
</TR>
</table><br><BR>
");Thanks