• Announcements

    • boen_robot

      Guidelines and Netiquette   03/28/2017

      Posting Problems:   Having problems posting your topic? Read through this: To join, you agree to our terms and conditions and fill out and submit a registration form. An activation email will be sent to your email adress, so you'll need to verify your account. After that the account has to be validated by one of the moderators. This will mean that it can take up to a day to be activated. A couple of things to remember to ensure approval: Don't use an email address in one of those $2 four character .com domains eg. xyds.com. These will be deleted and the domain added to the banned list. Don't use an email address that is within a domain with a bad reputation for spam. A Google search is run on every email address and email domain. Don't sign up with an email address that doesn't exist, doesn't work or requires the sender to answer a quiz before their email can get to you. Put your country and or state and city in the signup form. Blank forms will go to the botton of the "to do" list. And make sure that your email address and your country match, saying you're from Alabama and using a .ru email address is not going to get you activated. After a membership is activated the first few posts will be monitored. Posting spam or unapproved topics described in the agreement results in an immediate ban. The email provider and the IP addresses associated with the account will be banned and all posts will be deleted. These strict measures have been deemed necessary to hinder spam. Sorry for any inconvenience this causes, but it's not liable to change. If, after reading this, you still can't post and don't understand why, contact one of the Moderators listed here.   Topic Guidelines   Including the following information can expedite an accurate response from board members: Must be a Specific Problem or Question related to web design and development Include Code in Question (wrap with   for small blocks of code and for longer blocks   ) Include Code Author Include Extra Notes/Modifications/Attempts Include web link to page/file when possible Content Guidelines   You may not post, upload, link to, or email any Content that contains, promotes, gives instruction about, or provides prohibited Content. Prohibited Content includes any Content that breaks any local, state, county, national or international law. Prohibited Content also includes: No direct or indirect advertising or websites, forums, products, services No hijacking of posts (do not post your question in someone elses) Content that infringes upon any rights [ex. MP3s and ROMs] (including, but not limited to, copyrights and trademarks) Abusive, threatening, defamatory, racist, or obscene Viruses or any other harmful computer software False Information or libel Spam, chain letters, or Pyramid schemes Gambling or Illicit drugs Terrorism Hacking or cheating for internet/online games Warez, Roms, CD-Keys, Cracks, Passwords, or Serial Numbers Pornography, nudity, or sexual material of any kind Excessive profanity Invasive of privacy or impersonation of any person/entity Hacking materials or information Posting Tips   There are more BBcodes than there are buttons for on the reply menu. To get the full list, click "BB Code Help" underneath the clickable smilie face menu. Use   for small snippets of code Use   for lengthy snippets of code Use   if your snippet is HTML (optional) Use   if your snippet is SQL (optional) Rules of Conduct   Be nice. There's no need for calling someone stupid if they ask an 'easy' question. Keep your avatars and signatures absolutely child friendly. We have a younger audience on this forum. Keep your language appropriate for the same reason above. Do not PM moderators for help on the forum. Post on the topic, or create a new one.   Spam:   Recently, as you have all without doubt noticed, we have had lots of spam and advertisement on the forum. Therefore, we'd like to alert you as to what to do when you have found any of the aforementioned annoying messages: it. Immediately. Give a clear reason, please, if the advertising is not evident. DO NOT POST! Report, let the post stay as is, and we will get to it, meanwhile if you continue to post as normal in the other threads, it won't be on the top so long. Refrain from PMing the member. This won't help at all, as they are most likely spambots anyway. Thank you.       Images in signatures:   After thinking of users on dial-up, we have decided to enforce the following rules regarding signatures. Please pay heed to them. Respecting these rules is respecting the members on this forum with dial-up. Signature rules: No animated images AT ALL. No matter the amount of animation. Maximum image widthxheight: 300x150 Maximum image (file) size: 15kb Use calm colors. Do not use highly contrasting images in your signature, as this can get really annoying when seeing several posts from one member in the same thread. The same prohibited content goes for images as for posts. Lastly, use common sense. No lengthy signatures please. Save us some scrolling. Thank you.       Links in signatures:   Please understand that w3schools.com only exists because of voluntary work and is barely supported by the advertising littered throughout the tutorials and the forum. So, please, stop advertising other sites. DO not post links that drive traffic away from the w3schools domain - especially to a site that offers similar if not identical information. Please help support the site by keeping individuals on it. Thank you. Here are some guidelines as to what you can put in your signature: w3schools links --> allowed w3.org links --> allowed browser links --> allowed html editor links --> allowed personal sites --> allowed tutorial sites competing with w3schools --> NOT allowed sites completely irrelevant to webprogramming and this forum --> NOT allowed   Thanks for understanding, and for taking the time to read this. ~W3Schools Modstaff~
skyhighweb

Still On submenu issue

15 posts in this topic

Am able to use this code to bind a.id = :auc_id in order to display certain result needed for menu code, but when i introduce it in the submenu i dont get any result below are the codes for menu and submenu'

MENU works fine, display whats need to be showned thanks to a.id = :auc_id

$query = "SELECT s.team_id, s.teams AS teams1, ss.team_id, ss.teams AS teams2, a.id, a.team1, a.team2 FROM " . $DBPrefix . "auctions a
        LEFT JOIN " . $DBPrefix . "sports s ON (s.team_id = a.team1)
        LEFT JOIN " . $DBPrefix . "sports ss ON (ss.team_id = a.team2)
        WHERE a.id = :auc_id and a.id = a.id";
        $params = array();
        $params[] = array(':auc_id', $id, 'int');
        $db->query($query, $params);
?>

<script type="text/javascript" src="js/dropdownjquery.js"></script>
<script type="text/javascript">
$(document).ready(function() {
    
    $("#menu").change(function() {
        $(this).after('<div id="loader"><img src="images/loading.gif" alt="loading subcategory" /></div>');
        $.get('loadsubcat.php?menu=' + $(this).val(), function(data) {
            $("#sub_cat").html(data);
            $('#loader').slideUp(200, function() {
                $(this).remove();
            });
        });    
    });

});
</script>
<form name="bid">
    <label for="category">Select Winner</label>
    <select name="willwin" id="menu">
    
    <?php
if ($db->numrows() > 0){
        while ($row = $db->fetch()) { ?>
        <option value=''></option>
        <option value="<?php echo $row["team1"]; ?>"><?php echo $row["teams1"]; ?></option>
        <option value="<?php echo $row["team2"]; ?>"><?php echo $row["teams2"]; ?></option>
        <?php
}
}
?>

SUBMENU displays all the details in

bid table
column auction    bidder    willwin    willlose
    38    4    3    2
    39    4    2    4
    39    5    4    2

the result should have a display for column ((auction) 38)  willwin (3) but instead i get 3,2,4

<?php
include('config.php');

$menu = $_GET['menu'];
$query = mysql_query("SELECT a.id, s.team_id, s.teams, u.nick, b.id, b.willwin, b.willlose, b.bidder FROM vs_bids b
LEFT JOIN " . $DBPrefix . "vs_users u ON (u.id = b.bidder)
LEFT JOIN " . $DBPrefix . "vs_auctions a ON (a.id = b.auction)
LEFT JOIN " . $DBPrefix . "vs_sports s ON (s.team_id = b.willwin)
WHERE willlose='$menu' and a.id = b.auction and b.bidder NOT IN ('b.tagged') and b.tagged IN ('b.bidder')");

while($row = mysql_fetch_array($query)) {
    echo "<option value=''></option>";
    echo "<option value='$row[team_id]'>$row[nick]...$row[teams]</option>";
}
?>

i cant seem to introduce b.auction = :auc_id which will help in displaying the correct result, but once have converted it like the menu above but doesnt seem to work, so i converted it back.
please need help with the issue here, thanks.

Share this post


Link to post
Share on other sites

Your second piece of code is using the mysql extension, which does not support prepared statements at all.  You should convert that so that all of your code is consistent and using the same database extension.

Share this post


Link to post
Share on other sites
17 hours ago, justsomeguy said:

Your second piece of code is using the mysql extension, which does not support prepared statements at all.  You should convert that so that all of your code is consistent and using the same database extension.

yeah have tried and tried but it just wont display result anytime i tried, i could only convert the first part but the second part wont, i guess am missing something or not including something, but no way for me to know what am doing wrong

Share this post


Link to post
Share on other sites

Yeah, I would guess that you're missing something too, but no way for me to know without seeing what you're doing.  Then the way that I would figure out whether or not you're doing something wrong is to look at the documentation and compare that with what you're doing, which you're also capable of doing yourself.  There is a way for you to know if what you're doing is wrong, it just takes time and effort.

Share this post


Link to post
Share on other sites
13 hours ago, justsomeguy said:

Yeah, I would guess that you're missing something too, but no way for me to know without seeing what you're doing.  Then the way that I would figure out whether or not you're doing something wrong is to look at the documentation and compare that with what you're doing, which you're also capable of doing yourself.  There is a way for you to know if what you're doing is wrong, it just takes time and effort.

thats just the thing when ever i try to convert it like i did the first part it displaying result i even was trying a back up plan for the now i hit a road block

the code below

<div class="form-group">
        <label class="col-sm-5 control-label">Select Winner</label>
        <div class="col-sm-7">                        
    <select name="willwin" class="form-control" id="first">
      <!-- BEGIN select_team -->
      <option value='1'>select_team</option>
      <option value='2'>{select_team.TAGTEAM1}</option>
      <option value='3'>{select_team.TAGTEAM2}</option>
</select><!-- END select_team -->
        
<br>
<select name="willlose" class="form-control" id="first_selected">

</div>
</div>        
                            
    <script type="text/javascript">
    
    $(document).ready(function() {
    var dropdown = {
        1 : ['Select a winner to trigger'],
        2 : ['{select_team.TAGTEAM2}'],
        3 : ['{select_team.TAGTEAM1}']
                  
    }
    $('#first_selected').html(
            '<option>'+dropdown[1].join('</option><option>')+'</option>'
        );
    $('#first').on('change',function() {
        $('#first_selected').html(
            '<option>'+dropdown[$(this).val()].join('</option><option>')+'</option>'
        );
    });
})
        </script>

when ever i submit the form the value get inserted but the value that insert are the numbers <option value='2'> and <option value='3'> instead of what beside them, it a swap code and those values is what been used by the javascript to swap  if only the codes could be change to make the javascript use something else instead of val to swap, hope u understand

Share this post


Link to post
Share on other sites

That's what it is supposed do! Submit value not text description, all form inputs submit values. If you want text description use that within value as well, or insert both separated by comma and retrieve by using index, as I think we have discussed before.

Share this post


Link to post
Share on other sites
30 minutes ago, dsonesuk said:

That's what it is supposed do! Submit value not text description, all form inputs submit values. If you want text description use that within value as well, or insert both separated by comma and retrieve by using index, as I think we have discussed before.

u mean like this  <option value='1','{TEAM1}'>{TEAM1}</option> ?if yes didnt work

Share this post


Link to post
Share on other sites

Do you actually try to understand how the values are shown in this code, or do you purposely just type anything on the chance we will do it all for you? This is obviously wrong! So NO! it will never work! the only thing I will tell you is the combined values should between one starting quote and one finishing quote with comma separating each value, as explain in my previous topic example.

Share this post


Link to post
Share on other sites
1 minute ago, dsonesuk said:

Do you actually try to understand how the values are shown in this code, or do you purposely just type anything on the chance we will do it all for you? This is obviously wrong! So NO! it will never work! the only thing I will tell you is the combined values should between one starting quote and one finishing quote with comma separating each value, as explain in my previous topic example.

<option value='1','autualext'>{TEAM1}</option> u mean something like that?

Share this post


Link to post
Share on other sites

No! Nothing like what I said. In you previous example you have set it up correctly to show values from whatever. I explained in another topic how this should be done also.

Share this post


Link to post
Share on other sites
2 minutes ago, dsonesuk said:

No! Nothing like what I said. In you previous example you have set it up correctly to show values from whatever. I explained in another topic how this should be done also.

and it didnt work well in the previous example thats y am asking how can it b done, saying it to me wont help

Share this post


Link to post
Share on other sites
Just now, dsonesuk said:

I give up! bye...

yeah take care

Share this post


Link to post
Share on other sites

There's no need to guess what the right way is, just look it up.  There's a basic reference here:

https://www.w3schools.com/tags/tag_option.asp

Here's a more authoritative one:

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/option

value
The content of this attribute represents the value to be submitted with the form, should this option be selected.

Share this post


Link to post
Share on other sites
On 6/2/2017 at 7:49 PM, justsomeguy said:

There's no need to guess what the right way is, just look it up.  There's a basic reference here:

https://www.w3schools.com/tags/tag_option.asp

Here's a more authoritative one:

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/option

 

 

decided for now to do things a bit manual i wrote this code to check if a user is selecting the same team as the bidder they are tagging to return error

 

Quote

$query = "SELECT willwin FROM " . $DBPrefix . "bids WHERE bidder = :tagged and auction = :auc_id and willwin = :willwin"; $params[] = array(':tagged', $bidder, 'int'); $params[] = array(':auc_id', $id, 'int'); $params[] = array(':willwin' , $willwin, 'int');

not want i want fully but still get the job done

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now