Jump to content

[SOLVED] Duplicate error - please explain


jf3000

Recommended Posts

[code]<?php
$title = $desc = "Friend Train";
$trainCount = 0;
foreach ($trainArray as $aTemp) {
$trainCount++;
}

$code.= "<form action=\"" . HOMEPAGE . "trainadd\" method=\"POST\"><table border=0 width=100% cellpadding=5 cellspacing=0 bgcolor=ffffff>";
$code.= "<tr>";
$code.= "<td bgcolor=ffffff>";
$code.= "<table border=0 cellpadding=0 cellspacing=0 width=100%>";
$code.= "<tr>";
$code.= "<td align=left>";
$code.= "<font size=2 color=ffffff>?Featured MySpace Profile</font>";
$code.= "</td>";
$code.= "<td align=right>";

$code.= "</td>";
$code.= "</tr>";
$code.= "</table>";
$code.= "</td>";
$code.= "</tr>";
$code.= "<tr>";
$code.= "<td>";
$code.= "<table border=0 cellpadding=5 cellspacing=1 width=100% bgcolor=ffffff>";
$code.= "<tr>";
$code.= "<td width=67 valign=middle ";
if ($featuredArray['gender'] == "Male") {
$code.= "bgcolor=99ccff";
} elseif ($featuredArray['gender'] == "Female") {
$code.= "bgcolor=f7d7f0";
} else {
$code.= "bgcolor=ffcc99";
}
$code.= ">";
$code.= "<center><img src=\"" . $featuredArray['pictureurl'] . "\" width=60 height=60></center>";
$code.= "</td>";
$code.= "<td valign=middle ";
if ($featuredArray['gender'] == "Male") {
$code.= "bgcolor=99ccff";
} elseif ($featuredArray['gender'] == "Female") {
$code.= "bgcolor=f7d7f0";
} else {
$code.= "bgcolor=ffcc99";
}
$code.= ">";
$code.= "<font size=2><b>Name:</b> " . $featuredArray['display'] . "<br></font>";
if ($featuredArray['gender'] <> "Band") {
$code.= "<font size=1><b>Age:</b> " . $featuredArray['age'] . "<br>";
} else {
$code.= "<font size=1><b>Genre:</b> " . $featuredArray['age'] . "<br>";
}
$code.= "<b>Quote:</b> " . $featuredArray['quote'] . "<br></font>";
$code.= "<a target=\"_blank\" href=\"http://profile.myspace.com/index.cfm?fuseaction=user.viewprofile&friendID=" . $featuredArray['id'] . "\"><u>View MySpace Profile</u></a>";
$code.= "</td>";
$code.= "<td valign=middle align=center width=80 bgcolor=ffffff>";
$code.= "<a target=\"_blank\" href=\"http://www.myspace.com/index.cfm?fuseaction=invite.addfriend_verify&friendID=" . $featuredArray['id'] . "\"><STRONG><font size=3>ADD TO FRIENDS</font></STRONG></a>";
$code.= "</td>";
$code.= "</tr>";
$code.= "</table>";
$code.= "</td>";
$code.= "</tr>";
$code.= "</table>";


$code.= "<br>";

$code.= "<table border=0 width=100% cellpadding=5 cellspacing=1 bgcolor=ffffff>";
$code.= "<tr>";
$code.= "<td bgcolor=ffffff>";
$code.= "<font size=2 color=ffffff>?Join the Train</font>";
$code.= "</td>";
$code.= "</tr>";
$code.= "<tr>";
$code.= "<td>";
$code.= "<center>";
$code.= "<input type=\"hidden\" name=\"page\" value=\"addconfirm\">";
$code.= "<font size=2><b>Input MySpace ID:</b></font><br>";
$code.= "<input type=\"text\" name=\"input_id\" maxlength=15><br>";
$code.= "<font size=2><b>Input a message/ quote:</b></font><br>";
$code.= "<input type=\"text\" name=\"input_quote\" maxlength=25><br>";
$code.= "<input type=\"checkbox\" name=\"profileisband\" value=\"1\" id=\"profileisband\">";
$code.= "<label for=\"profileisband\">Band Profile</label><br>";
$code.= "<font size=1><i><b>Band Profiles: Please put your URL for the ID (Example: takingbacksunday).</b></i></font><br><br>";
$code.= "<small><i>The Friend Train will automatically retrieve your age, name, and picture from MySpace.</i></small><br>";
$code.= "<input type=\"submit\" value=\"Submit\"></center>";
$code.= "</td>";
$code.= "</tr>";
$code.= "</table>";

$code.="<br>";
$code.= "<center><b><font size=3>Current Round: " . $train_currentcount . " (" . $trainCount . "/40) People</font></b></center>";
$code.= "<br>";
$code.= "<table border=0 width=100% cellpadding=5 cellspacing=0 bgcolor=ffffff>";
$code.= "<tr>";
$code.= "<td bgcolor=ffffff>";
$code.= "<table border=0 cellpadding=0 cellspacing=0 width=100%>";
$code.= "<tr>";
$code.= "<td align=left>";
$code.= "<font size=2 color=ffffff>?Friend Train</font>";
$code.= "</td>";
$code.= "<td align=right>";

$code.= "</td>";
$code.= "</tr>";
$code.= "</table>";
$code.= "</td>";
$code.= "</tr>";
$code.= "<tr>";
$code.= "<td>";
$code.= "<table border=0 cellpadding=5 cellspacing=1 width=100% bgcolor=ffffff>";
$trainCount = 0;
foreach ($trainArray as $aTemp) {
$trainCount++;
$code.= "<tr>";
$code.= "<td width=25 valign=middle ";
if ($trainArray[$trainCount]['gender'] == "Male") {
$code.= "bgcolor=99ccff";
} elseif ($trainArray[$trainCount]['gender'] == "Female") {
$code.= "bgcolor=f7d7f0";
} else {
$code.= "bgcolor=ffcc99";
}
$code.= ">";
$code.= "<center><img src=\"" . $trainArray[$trainCount]['pictureurl'] . "\" width=60 height=60></center>";
$code.= "</td>";
$code.= "<td valign=middle ";
if ($trainArray[$trainCount]['gender'] == "Male") {
$code.= "bgcolor=99ccff";
} elseif ($trainArray[$trainCount]['gender'] == "Female") {
$code.= "bgcolor=f7d7f0";
} else {
$code.= "bgcolor=ffcc99";
}
$code.= ">";
$code.= "<font size=2><b>Name:</b> " . $trainArray[$trainCount]['display'] . "<br></font>";
if ($trainArray[$trainCount]['gender'] <> "Band") {
$code.= "<font size=1><b>Age:</b> " . $trainArray[$trainCount]['age'] . "<br>";
} else {
$code.= "<b>Genre:</b> " . $trainArray[$trainCount]['age'] . "<br></font>";
}
$code.= "<b>Quote:</b> " . $trainArray[$trainCount]['quote'] . "<br>";
$code.= "<a class=\"link_blacktored\" target=\"_blank\" href=\"http://profile.myspace.com/index.cfm?fuseaction=user.viewprofile&friendID=" . $trainArray[$trainCount]['id'] . "\"><u>View MySpace Profile</u></a>";
$code.= "</td>";
$code.= "<td valign=middle align=center width=80 bgcolor=ffffff>";
$code.= "<a class=\"link_blacktored\" target=\"_blank\" href=\"http://www.myspace.com/index.cfm?fuseaction=invite.addfriend_verify&friendID=" . $trainArray[$trainCount]['id'] . "\"><STRONG><font size=3>ADD TO FRIENDS</font></STRONG></a>";
$code.= "</td>";
$code.= "</tr>";
}
$code.= "</table>";
$code.= "</td>";
$code.= "</tr>";
$code.= "</table></form>";
$code = str_replace("<", "&lt;", $code);
$code = str_replace(">", "&gt;", $code);
$code = str_replace("\"", "&quot;", $code);


?>
<div align="center">
  <?
  require_once( ROOT_DIR ."/include/db.php");
$sql = "select * from ad WHERE style='468x60'";
$rs = $db->Execute( $sql );
echo $rs->fields['content'];
?>
</div>
<center>
<table border=0 width=70% cellpadding=5 cellspacing=1 bgcolor=ffffff>
                          <tr >
                            <td bgcolor=#FFFFFF>
                              <div align="center">
<h1>
<font class="txt_orange_bold" color="#FF0000" >JOIN
                                  THE TRAIN</font></h1>
</div>
                            </td>
                          </tr>
                          <tr>
                            <td>
                              <form action="<?=HOMEPAGE?>trainadd" method="POST">
                                <div align="center">
                                  <input type="hidden" name="page" value="addconfirm">
                                  <b>
                                  <font color="#FF0000">Input MySpace ID:</font></b><br>
                                  <input name="input_id" type="text" size="50" maxlength=50>
                                  <br>
                                  <font color="#FF0000"><b>Input a message/ quote:</b></font><br>
                                  <input name="input_quote" type="text" size="50" maxlength=25>
                                  <br>
                                  <input type="checkbox" name="profileisband" value="1" id="profileisband">
                                  <label for="profileisband">Band Profile</label>
                                  <br>
                                  <font color="#003399"><i>Bands: Put your URL
                                  for the ID<br>
                                                Example: jayz</i></font><font size=1><br>
                                  </font><br>
                                  <input name="submit" type="submit" value="JOIN THE TRAIN">
                                </div>
                              </form>
                            </td>
                          </tr>
                        </table>
<table border=0 width=70% cellpadding=5 cellspacing=0 bgcolor=ffffff>
<tr>
<td bgcolor=ffffff>
<table border=0 cellpadding=0 cellspacing=0 width=100%>
<tr>
<td align=left bgcolor="#FFFFFF">
<div align="center"><b>
<font class="txt_orange_bold" color="#FF0000"> FEATURED MYSPACE PROFILE</font></b></div></td>
<td align=right>&nbsp;
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table border=0 cellpadding=5 cellspacing=1 width=100% bgcolor=ffffff>
<tr><?php
echo "<td width=67 valign=middle ";
if ($featuredArray['gender'] == "Male") {
echo "bgcolor=99ccff";
} elseif ($featuredArray['gender'] == "Female") {
echo "bgcolor=f7d7f0";
} else {
echo "bgcolor=ffcc99";
}
echo ">";
echo "<center><img src=\"" . $featuredArray['pictureurl'] . "\" width=60 height=60></center>";
echo "</td>";
echo "<td valign=middle ";
if ($featuredArray['gender'] == "Male") {
echo "bgcolor=99ccff";
} elseif ($featuredArray['gender'] == "Female") {
echo "bgcolor=f7d7f0";
} else {
echo "bgcolor=ffcc99";
}
echo ">";
echo "<font size=2><b>Name:</b> " . $featuredArray['display'] . "<br></font>";
if ($featuredArray['gender'] <> "Band") {
echo "<b><font size=1>Age:</b> " . $featuredArray['age'] . "<br>";
} else {
echo "<b><font size=1>Genre:</b> " . $featuredArray['age'] . "<br>";
}
echo "<b>Quote:</b> " . $featuredArray['quote'] . "<br></font>";
echo "<a class=\"link_blacktored\" target=\"_blank\" href=\"http://profile.myspace.com/index.cfm?fuseaction=user.viewprofile&friendID=" . $featuredArray['id'] . "\"><u>View MySpace Profile</u></a>";
echo "</td>";
echo "<td valign=middle align=center width=80 bgcolor=ffffff>";
echo "<a class=\"link_blacktored\" target=\"_blank\" href=\"http://www.myspace.com/index.cfm?fuseaction=invite.addfriend_verify&friendID=" . $featuredArray['id'] . "\"><STRONG><font size=3>ADD TO FRIENDS</font></STRONG></a>";
echo "</td>";
?></tr>
</table>
</td>
</tr>
</table>
<table border=0 cellpadding=0 cellspacing=0 height=6><tr><td></td></tr></table>
<table border=0 cellpadding=0 cellspacing=0 height=6><tr><td></td></tr></table>
<table border=0 width=70% cellpadding=5 cellspacing=0 bgcolor=ffffff>
<tr>
<td bgcolor=ffffff>
<table border=0 cellpadding=0 cellspacing=0 width=100%>
<tr>
<td align=left bgcolor="#FFFFFF" bordercolor="#000000">
<div align="center"><b>
<font class="txt_orange_bold" color="#0000FF" >FRIEND
    TRAIN</font></b></div></td>
<td align=right>&nbsp;
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table border=0 cellpadding=5 cellspacing=1 width=100% bgcolor=ffffff>
<?php
$trainCount = 0;
foreach ($trainArray as $aTemp) {
$trainCount++;
echo "<tr>";
echo "<td width=67 valign=middle ";
if ($trainArray[$trainCount]['gender'] == "Male") {
echo "bgcolor=99ccff";
} elseif ($trainArray[$trainCount]['gender'] == "Female") {
echo "bgcolor=f7d7f0";
} else {
echo "bgcolor=ffcc99";
}
echo ">";
echo "<center><img src=\"" . $trainArray[$trainCount]['pictureurl'] . "\" width=60 height=60></center>";
echo "</td>";
echo "<td valign=middle ";
if ($trainArray[$trainCount]['gender'] == "Male") {
echo "bgcolor=99ccff";
} elseif ($trainArray[$trainCount]['gender'] == "Female") {
echo "bgcolor=f7d7f0";
} else {
echo "bgcolor=ffcc99";
}

echo ">";
echo "<font size=2><b>Name:</b> " . $trainArray[$trainCount]['display'] . "<br></font>";
if ($trainArray[$trainCount]['gender'] <> "Band") {
echo "<font size=1><b>Age:</b> " . $trainArray[$trainCount]['age'] . "<br>";
} else {
echo "<b>Genre:</b> " . $trainArray[$trainCount]['age'] . "<br>";
}
echo "<b>Quote:</b> " . $trainArray[$trainCount]['quote'] . "<br></font>";
echo "<a class=\"link_blacktored\" target=\"_blank\" href=\"http://profile.myspace.com/index.cfm?fuseaction=user.viewprofile&friendID=" . $trainArray[$trainCount]['id'] . "\"><u>View MySpace Profile</u></a>";
echo "</td>";
echo "<td valign=middle align=center width=80 bgcolor=ffffff>";
echo "<a class=\"link_blacktored\" target=\"_blank\" href=\"http://www.myspace.com/index.cfm?fuseaction=invite.addfriend_verify&friendID=" . $trainArray[$trainCount]['id'] . "\"><STRONG><font size=3>ADD TO FRIENDS</font></STRONG></a>";
echo "</td>";
echo "</tr>";
}
?>
</table>
</td>
</tr>
</table>
</center>[/code]
I suspect that the way you've set up your db table is the issue.  From the error message it looks like you are trying to write the same information to a field that is set to be unique.  Make sure the the named fields are not set to be primary or unique.

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.