Jump to content

Recommended Posts

Alright I have a list of items that are under PendingOffers and a list of items under Offers. I need it where if the offer was placed in PendingOffers (offerid is the id of the offer) it does not show when I list Offers. I figure something basicly Id!=Offerid I get it to work half*** (example: Complete offerid = 1 then it don't show offer=1 but if offer=3 is completed...it shows offer=1 again but not 3...I need it to not show any pending offers lets say it be 1-3-6-9 but show 2-4-5-7-8

 

 

Please note I know this is wrong:

 

 

$ad_query = mysql_query("SELECT offerid FROM pendingoffers WHERE user='$user'") or die(mysql_error());

if (mysql_num_rows($ad_query)>0) {

 

 

$tabla = mysql_query("SELECT * FROM offerads WHERE user!='$user' ORDER BY id ASC");

while ($registro = mysql_fetch_array($tabla)) {

 

while ($rowz = mysql_fetch_array($ad_query)) {

$ad=$rowz["offerid"];

 

$iz=$registro["id"];

 

if ($iz!=$ad){

 

echo "<TR>

<TD NOWRAP ALIGN=LEFT CLASS=Style2 HEIGHT=0px>". $registro["description"] ."</TD>

<TD NOWRAP ALIGN=LEFT CLASS=Style2 HEIGHT=0px><a href=\"". $registro["url"] ."/\" target=\"_blank\">". $registro["url"] ."</a></TD>

<TD NOWRAP ALIGN=LEFT CLASS=Style1 HEIGHT=0px>". $registro["value"] ."</TD>

 

";

?>

<TD NOWRAP ALIGN=LEFT CLASS=Style2 HEIGHT=0px><form method="post" action="completeoffer.php?id=<?= $registro["id"] ?>"><input type="hidden" value="<?= $registro["user"] ?>" class="text" name="owner"><input type="submit" value="Complete" class="button"></form></TD>

</TR>

<?

}

}

}

 

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/173461-pending-help/
Share on other sites

mysql version: 5.0.81-community

note exactly sure what it means by no variables? but here is code:

<? session_start(); ?>


<? include('header.php');
require('config.php');
$sql = "SELECT * FROM site";
$result = mysql_query($sql);        
$row = mysql_fetch_array($result);
mysql_close($con);
$enableoffers = $row['enableoffers'];
	if($enableoffers == "yes") {
?>
        <!-- Pagetitle -->
        <br><h3>Offers</h3>
<font color=green>To complete an offer click on the link provided next to the requirements and complete off the requirements listed, once completed come back and click the "Complete" button.</font>
<br>



<STYLE TYPE="text/css"><!--
.Style0 { border-style: solid; padding:3; border-left-width: 0; border-top-width: 0; border-right-width: 0; border-bottom-width: 0; border-left-color: rgb(0,0,0); border-top-color: rgb(0,0,0); border-right-color: rgb(0,0,0); border-bottom-color: rgb(0,0,0); font-family: 'Tahoma'; mso-font-charset: 1; font-size: 8pt; color: rgb(172,168,153); background-color: rgb(255,255,255)}

.Style1 { border-style: solid; padding:3; border-left-width: 1; border-top-width: 1; border-right-width: 1; border-bottom-width: 1; border-left-color: rgb(157,157,161); border-top-color: rgb(157,157,161); border-right-color: rgb(157,157,161); border-bottom-color: rgb(157,157,161); font-family: 'Tahoma'; mso-font-charset: 1; font-size: 8pt; color: rgb(0,0,0); background-color: rgb(224,223,227)}

.Style2 { border-style: solid; padding:3; border-left-width: 0; border-top-width: 0; border-right-width: 0; border-bottom-width: 0; border-left-color: rgb(0,0,0); border-top-color: rgb(0,0,0); border-right-color: rgb(0,0,0); border-bottom-color: rgb(0,0,0); font-family: 'Tahoma'; mso-font-charset: 1; font-size: 8pt; color: rgb(0,0,0); background-color: rgb(255,255,255)}

.Style3 { border-style: solid; padding:3; border-left-width: 0; border-top-width: 0; border-right-width: 0; border-bottom-width: 0; border-left-color: rgb(0,0,0); border-top-color: rgb(0,0,0); border-right-color: rgb(0,0,0); border-bottom-color: rgb(0,0,0); font-family: 'Tahoma'; mso-font-charset: 1; font-size: 8pt; color: rgb(0,0,0); background-color: rgb(255,255,255)}

.Style4 { border-style: solid;padding:0px; border-left-width: 0; border-top-width: 0; border-right-width: 0; border-bottom-width: 0; border-left-color: rgb(0,0,0); border-top-color: rgb(0,0,0); border-right-color: rgb(0,0,0); border-bottom-color: rgb(0,0,0); font-family: 'Tahoma'; mso-font-charset: 1; font-size: 1pt; color: rgb(0,0,0); background-color: rgb(255,255,255)}

--></STYLE>
<TABLE class=maintable BORDER=0 CELLSPACING=0 WIDTH=75%>
<TR>
<TD  WIDTH=170 HEIGHT=0></TD>
<TD  WIDTH=60 HEIGHT=0></TD>
<TD  WIDTH=25 HEIGHT=0></TD>
</TR>
<TR>
<TD NOWRAP ALIGN=LEFT CLASS=Style1 HEIGHT=0px>Offer Description</TD>
<TD NOWRAP ALIGN=LEFT CLASS=Style1 HEIGHT=0px>Website</TD>
<TD NOWRAP ALIGN=LEFT CLASS=Style1 HEIGHT=0px>Value</TD>
<TD NOWRAP ALIGN=LEFT CLASS=Style1 HEIGHT=0px>Complete</TD>
</TR>
<?
include("config.php");
$user=$_COOKIE["usNick"];
$sql = "SELECT * FROM offerads";
$result = mysql_query($sql);        
$row = mysql_fetch_array($result);
$id = $row["id"];
$ad_query = mysql_query("SELECT id FROM offerads WHERE id='$id' AND tipo='offers' AND CONVERT(signups,UNSIGNED) < CONVERT(plan,UNSIGNED)") or die(mysql_error());
if (mysql_num_rows($ad_query)<1) {

$tabla = mysql_query("SELECT * FROM offerads WHERE user!='$user' AND tipo='offers' AND CONVERT(signups,UNSIGNED) < CONVERT(plan,UNSIGNED)") or die(mysql_error());
while ($registro = mysql_fetch_array($tabla)) {

echo "<TR>
<TD NOWRAP ALIGN=LEFT CLASS=Style2 HEIGHT=0px>". $registro["description"] ."</TD>
<TD NOWRAP ALIGN=LEFT CLASS=Style2 HEIGHT=0px><a href=\"". $registro["url"] ."/\" target=\"_blank\">". $registro["url"] ."</a></TD>
<TD NOWRAP ALIGN=LEFT CLASS=Style1 HEIGHT=0px>". $registro["value"] ."</TD>

";
?>
<TD NOWRAP ALIGN=LEFT CLASS=Style2 HEIGHT=0px><form method="post" action="completeoffer.php?id=<?= $registro["id"] ?>"><input type="hidden" value="<?= $registro["user"] ?>" class="text" name="owner"><input type="submit" value="Complete" class="button"></form></TD>
</TR>

<?

}
}else{
$ad_query = mysql_query("SELECT offerid FROM pendingoffers WHERE user='$user'") or die(mysql_error());
if (mysql_num_rows($ad_query)>0) {

while ($rowz = mysql_fetch_array($ad_query)) {
$ad=$rowz["offerid"];

$tabla = mysql_query("SELECT * FROM offerads WHERE user!='$user' ORDER BY id ASC");
while ($registro = mysql_fetch_array($tabla)) {

$iz=$registro["id"];

if ($iz!=$ad){

echo "<TR>
<TD NOWRAP ALIGN=LEFT CLASS=Style2 HEIGHT=0px>". $registro["description"] ."</TD>
<TD NOWRAP ALIGN=LEFT CLASS=Style2 HEIGHT=0px><a href=\"". $registro["url"] ."/\" target=\"_blank\">". $registro["url"] ."</a></TD>
<TD NOWRAP ALIGN=LEFT CLASS=Style1 HEIGHT=0px>". $registro["value"] ."</TD>

";
?>
<TD NOWRAP ALIGN=LEFT CLASS=Style2 HEIGHT=0px><form method="post" action="completeoffer.php?id=<?= $registro["id"] ?>"><input type="hidden" value="<?= $registro["user"] ?>" class="text" name="owner"><input type="submit" value="Complete" class="button"></form></TD>
</TR>
<?
}
}
}


}else{

$tabla = mysql_query("SELECT * FROM offerads WHERE user!='$user' ORDER BY id ASC");
while ($registro = mysql_fetch_array($tabla)) {

echo "<TR>
<TD NOWRAP ALIGN=LEFT CLASS=Style2 HEIGHT=0px>". $registro["description"] ."</TD>
<TD NOWRAP ALIGN=LEFT CLASS=Style2 HEIGHT=0px><a href=\"". $registro["url"] ."/\" target=\"_blank\">". $registro["url"] ."</a></TD>
<TD NOWRAP ALIGN=LEFT CLASS=Style1 HEIGHT=0px>". $registro["value"] ."</TD>

";
?>
<TD NOWRAP ALIGN=LEFT CLASS=Style2 HEIGHT=0px><form method="post" action="completeoffer.php?id=<?= $registro["id"] ?>"><input type="hidden" value="<?= $registro["user"] ?>" class="text" name="owner"><input type="submit" value="Complete" class="button"></form></TD>
</TR>
<?
}
}
}
?>
</TABLE>

<?
}else{
echo "This feature is disabled.";
}
?>
	<!--footer starts here-->
<? include('footer.php'); ?>

 

Only portion that needs editing is what i posted earlier tho...but here is the whole page....

 

No errors script works just not correctly.

 

Table for Offers

id, user, pemail, plan(basicly how many can be completed), url, description, ip, tipo, status

 

Table for PendingOffers

id, offerid(Logs ID from OFFER TABLE), user(you), owner(me), status, date, email

 

Output Error:

If PendingOffers offerid = 1 then it don't show offer=1 when i list offers, but if offerid=1 AND 3 is completed...it shows offer=1 again but not 3...

 

What I want:

I need it to not show any offers lets say it be 1-3-6-9 but show 2-4-5-7-8 that are listed in pendingOffers table under Offerid

 

I've attempted alot and just resorted to this as last resort. Only thing left to fix before I release website.

 

Hope that is all....If you need to know anything else feel free to reply with what you need i'll refresh every 20 minutes or so.

Link to comment
https://forums.phpfreaks.com/topic/173461-pending-help/#findComment-914446
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.