PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
siefkencp
Forum Commoner
Posts: 69 Joined: Thu Dec 16, 2004 8:50 am
Post
by siefkencp » Wed May 25, 2005 2:45 pm
Can any one take a look at this and see what I may be missing?
The problem is with the variable $planned_date I may have my syntax confused. Im not sure. I did try to have it comming out of the array like this $array['$field_name'] but that didn't work for me either. All code is below...
Thanks for any and all help.
Chris
Code: Select all
<?
$mailings = mysql_list_fields("sapcdb", "mail_schedule", $link) or die(mysql_error());
$totalcount = mysql_num_fields($mailings);
$group_query = mysql_query("SELECT * FROM `mail_schedule` WHERE `group_id` = '$g'");
$group_array = mysql_fetch_array($group_query, MYSQL_ASSOC);
?>
<br>
Viewing Group: <? echo $g; ?><br>
Total Mailings In Cycle: <? print $totalcount; ?><br><br>
To initialize this group's mailing cycle,
<a href="/admin/admissions/main/mailing/initializegroup.php?g=<? echo $g; ?>">
click here</a>.<br>
<br>
<form name="form1" method="post" action="">
<table>
<?
for ($i = 1; $i < $totalcount; $i++) {
$fieldname = mysql_field_name($mailings, $i);
$planned_date = $group_array[$field_name];
print $planned_date;
print "<tr>\n
<td>$fieldname</td>\n
<td><input name=\"$fieldname\" type=\"text\" value=\"$planned_date\"></input><br></td> \n
</tr>\n";
}
?>
<br>
<br>
</table>
<input type="submit" name="Submit" value="Submit">
</form>
siefkencp
Forum Commoner
Posts: 69 Joined: Thu Dec 16, 2004 8:50 am
Post
by siefkencp » Wed May 25, 2005 3:12 pm
I figured it out. I simply used mysql_fetch_row(); and changed the array to look for $array[$i] ..
Just in case any one else wants to accomplish something similar.
Chris
thomas777neo
Forum Contributor
Posts: 214 Joined: Mon Mar 10, 2003 6:12 am
Location: Johannesburg,South Africa
Post
by thomas777neo » Wed May 25, 2005 3:17 pm
Does your query
Code: Select all
SELECT * FROM `mail_schedule` WHERE `group_id` = '$g'
return more than one value?
You can also try this:
Code: Select all
$connect = mysql_connect("e;z"e;,"e;x"e;,"e;y"e;);
mysql_select_db("e;a"e;);
$sql = "e;select * from xyx"e;;
$exec = mysql_query($sql);
$arrayResult = array();
$arrayResultї0]ї"e;id"e;]=mysql_result($exec,0,"e;id"e;);
echo $arrayResultї0]ї"e;id"e;]."e;<br>"e;;
Why do you use
Code: Select all
$fieldname = mysql_field_name($mailings, $i);
Why not put the field name in by hand?
What is the structure of your table?
thomas777neo
Forum Contributor
Posts: 214 Joined: Mon Mar 10, 2003 6:12 am
Location: Johannesburg,South Africa
Post
by thomas777neo » Wed May 25, 2005 3:19 pm
Sorry, I was busy while you updated your question