|
-
Sep 18th, 2003, 07:43 PM
#1
Thread Starter
Hyperactive Member
Updateing tables in mysql *RESOLVED*
can i update more than one peice of information, i dont know the right word. what i have made is this page for the admin to see if the information submited buy users is factual or not. And i had a it print out the information from the database to see it then i had a checkbox to say if it was able to be viewed by the public. but im having some problems with it.. i dont understand how to make it update more than one or one, sql thing. ill show yo uhave i have....
PHP Code:
<form action="admin_check.php" method="post">
<?php
include("./admin/config.php");
mysql_connect($servername,$dbusername,$dbpassword) or die("Unable to connect to SQL server");
mysql_select_db($dbname) or die("Unable to select database");
if (isset($_POST['a_accept'])) {
$sql = "SELECT * FROM alumni";
$alumni = mysql_query($sql) or die(mysql_error());
while ($alumnus = mysql_fetch_array($alumni)) {
$id = $_POST[$alumnus['alumni_id']];
$update = "UPDATE `alumni` SET `alumni_ax` = '1' WHERE `alumni_id` = '$id'";
mysql_query($update);
}
} else {
$sql = "SELECT * FROM alumni";
$alumni = mysql_query($sql) or die(mysql_error());
echo '<table><tr><td colspan=3><hr color="#000000" noshade></td></tr>
<tr>';
while ($alumnus = mysql_fetch_array($alumni)) {
if ($alumnus['alumni_ax'] == 0) {
if ($i == 3) {
echo '</tr><tr>';
$i = 0;
}
echo '<td width="227" align="left" valign="top"><table><tr><td><b>' . $alumnus['alumni_name'] . '</b></td></tr>';
echo '<tr><td>' . $alumnus['alumni_year'] . '</td></tr>';
echo '<tr><td>' . $alumnus['alumni_address'] . '</td></tr>';
echo '<tr><td>' . $alumnus['alumni_phone'] . '</td></tr>';
if ($alumnus['alumni_email'] == '') { echo '<tr><td>n/a</td></tr>'; } else { echo '<tr><td><a href="mailto:' . $alumnus['alumni_email'] . '">' . $alumnus['alumni_email']. '</a></td></tr>'; }
echo '<tr><td>' . $alumnus['alumni_afterschool'] . '</td></tr>';
echo '<tr><td>' . '<input name="' . $alumnus['alumni_id'] . '" type="checkbox">' . ' Acceptable?</td></td></table><br></td>';
$i++;
}
}
echo '</tr>';
?>
<tr>
<td colspan=3>
<hr noshade color=black>
Are You sure these submissions are ok?<br>
<input name="a_accept" type="submit" value="Accept"> <input name="Clear" type="reset" value="clear">
</td>
</tr>
<?
echo '</table><br>';
}
?>
</form>
i hope you understood what i was talking about, and can help. thanks
Last edited by Muk108; Sep 22nd, 2003 at 05:57 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|