Jump to content

Recommended Posts

This is what i have

 

$traderss1=mysql_query("SELECT * FROM `poke_owned` WHERE `box`='1' AND `trainer`='" . $trading->username . "' ORDER BY `name` ASC");

 

How can i do this:

 

$traderss1=mysql_query("SELECT * FROM `poke_owned` WHERE `box`='1' AND `trainer`='" AND `traded`='0' . $trading->username . "' ORDER BY `name` ASC");

 

I know its not as simple as just adding  AND `traded`='0' cause i tried that and i just got this

 

Parse error: syntax error, unexpected '=' in /home/tpkrpgn1/public_html/trade5.php on line 57

 

MySQL table (in case you need to know it?)

(`id`, `trainer`, `gender`, `name`, `party1`, `party2`, `party3`, `party4`, `party5`, `party6`, `level`, `exp`, `hp`, `totalhp`, `att`, `def`, `box`, `days`, `battle_wins`, `battle_losses`, `move1`, `move2`, `move3`, `move4`, `attbon`, `defbon`, `totalexp`, `sold`, `traded`, `item`, `soldtrainer`)

I know its not as simple as just adding  AND `traded`='0' cause i tried that and i just got this

 

Obviously, you need to add it within the right place.

 

$traderss1=mysql_query("SELECT * FROM `poke_owned` WHERE `box` = 1 AND `trainer` = '" . $trading->username . "'  AND `traded` = 0 ORDER BY `name` ASC");

Yes, it is a simple as adding "AND traded='0' ".

 

Parse errors do NOT come from bad MySQL queries, they come from BAD PHP code.  Don't make the mistake of thinking they are the same engine, or language.

$traderss1=mysql_query("SELECT * FROM `poke_owned` WHERE `box`='1' AND `trainer`='{$trading->username}' AND `traded`='0' ORDER BY `name` ASC");

Fortunately that fixed half of the issue, Why only half? Cause it opened another one  :wtf:

 

Now when i run

 

$traderss1=mysql_query("SELECT * FROM `poke_owned` WHERE `box`='1' AND `trainer`='{$trading->username}' AND `traded`='0' ORDER BY `name` ASC");

 

It doesn't display my list anymore, Just the other persons list (It does EXACTLY what i wanted just cant see my list anymore)

 

So basically for the other persons list its like this

$traderss1=mysql_query("SELECT * FROM `poke_owned` WHERE `box`='1' AND `trainer`='{$trading->username}' AND `traded`='0' ORDER BY `name` ASC");

 

And the list maker

<td class="w50"><p class="center"><?=$trading->username?>'s Pokémon<br /><select name="othertrade[]" multiple="multiple" size="20"><option value="niks" selected>(No Pok&#233;mon)</option><?while($tradert=mysql_fetch_object($traderss1)){?><option value="<?=$tradert->id?>"><?=$tradert->name?> <?=$tradert->gender?> (Level:<?=$tradert->level?>)</option><?}?></select></p></td></table>

 

 

And for my list (As you can see i had to re-instate the old code :\

 

$owntraderss2=mysql_query("SELECT * FROM `poke_owned` WHERE `box`='1' AND `trainer`='" . $user->username . "' ORDER BY `name` ASC");

 

 

<form action="/trade5.php?a=<?=$_GET['q']?>" method="POST"><table class="w100"><tr><td class="w50"><p class="center">Your Pokémon<br /><select name="mytrade[]" multiple="multiple" size="20"><option value="niks" selected>(No Pok&#233;mon)</option><?while($owntradert=mysql_fetch_object($owntraderss2)){?><option value="<?=$owntradert->id?>"><?=$owntradert->name?> <?=$owntradert->gender?> (Level:<?=$owntradert->level?>)</option><?}?></select></p></td>

 

So is there any way to make it where BOTH lists can use the same thing?

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.