skyhighweb
-
Posts
86 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Posts posted by skyhighweb
-
-
Just now, dsonesuk said:
I give up! bye...
yeah take care
-
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
-
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?
-
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
-
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
-
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
-
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 2the 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. -
3 minutes ago, justsomeguy said:
This is the single worst response you can probably give. If you did it right, then it would have worked. If it didn't work, then you didn't do it right, but you didn't show any code to allow anyone to point out what you did wrong. It's not like people suggest all of these PHP functions that just don't work, PHP works fine, you're just not using it right, and you're also not showing anyone else what you did so that we can point out your errors. Incidentally, this is also why I stopped responding to your threads. I'm not here to do peoples' work for them, I'm trying to teach people.
ok, like i said i drop the code, i was interfereing with the loading speed and wasnt work well i tried another one still working on that one.
-
4 minutes ago, dsonesuk said:
IF you are using MYSQLI then this is
mysql_real_escape_string($_POST['willlose'])
IS WRONG!
it should be
mysqli_real_escape_string($_POST['willlose'])
Notice 'i' at end of 'mysql', most if not all of these specific mysqli functions begin with 'mysqli'.
tried all that, aam dropping the code.
-
<?php $query = "SELECT a.id, a.team1, a.title, a.team2, s.team_id, s.teams, u.nick, b.id, b.willwin, b.willlose, b.bidder, b.auction FROM bids b LEFT JOIN " . $DBPrefix . "users u ON (u.id = b.bidder) LEFT JOIN " . $DBPrefix . "auctions a ON (a.id = b.auction) LEFT JOIN " . $DBPrefix . "sports s ON (s.team_id = b.willwin) WHERE b.willlose = :menu and a.id = :auc_id and b.bidder NOT IN ('b.tagged') and b.tagged IN ('b.bidder')"; $params = array(); $params[] = array(':auc_id', $id, 'int'); $params[] = array(':menu', $menu, 'int'); $db->query($query, $params); while ($row = $db->fetch()) { echo "<option value=''></option>"; echo "<option value='$row[team_id]'>$row[nick]...$row[teams]</option>"; } ?>
-
On 5/20/2017 at 9:39 AM, dsonesuk said:
IS $willlose = mysql_real_escape_string($_POST['willlose']); returning a value?
Just make sure it returns a value first, and this
</select></div>
should be UNDER the php outputted options.
tried that didnt work
i got this other code been working on the menu part works fine but the submenu after converting to mysqli refuse to work
$query = "SELECT s.team_id, s.teams AS teams1, ss.team_id, ss.teams AS teams2, a.id, a.team1, a.team2, b.auction, b.bidder, b.tagged, b.willwin, b.willlose FROM " . $DBPrefix . "auctions a LEFT JOIN " . $DBPrefix . "bids b ON (b.auction = a.id) 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 group by 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('bid.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 } } ?> </select> <br/><br/><br/> <label>Tag Bettor</label> <select name="sub_cat" id="sub_cat"></select>
-
1 hour ago, dsonesuk said:
Then use delimiter to separate values and send as array of values, then use explode to separate those values by delimiter, and show the value required using index ref
<!DOCTYPE html> <!-- To change this license header, choose License Headers in Project Properties. To change this template file, choose Tools | Templates and open the template in the editor. --> <html> <head> <meta charset="UTF-8"> <title></title> </head> <body> <?php $teamRec = ""; $team_array = []; $team_array['Team1'] = ['Team #1 dropdown1', 'Team #1 dropdown2', 'Team #1 dropdown3', 'Team #1 dropdown4']; $team_array['Team2'] = ['Team #2 dropdown1', 'Team #2 dropdown2', 'Team #2 dropdown3', 'Team #2 dropdown4']; ?> <form id="myform" method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?>"> <select name="willwin" class="form-control" onchange="dothis()"> <option value="">Select Team </option> <?php $optioncount = 0; foreach ($team_array as $key => $value) { $optioncount++; if ($key === $teamRec) { echo '<option class="team' . $optioncount . '" value="' . $key . ', Team #' . $optioncount . '" selected="selected">Team #' . $optioncount . '</option>'; } else { echo '<option class="team' . $optioncount . '" value="' . $key . ', Team #' . $optioncount . '">Team #' . $optioncount . '</option>'; } } ?> </select><br> <?php if (isset($_POST['willwin'])) { $teamRec = explode(',', $_POST['willwin']); echo '1st $_POST["willwin"] value of Response: ' . $teamRec[0] . '<br>'; echo '2nd $_POST["willwin"] value of Response: ' . $teamRec[1] . '<br>'; } ?> <input type="submit"> </form> <script> function dothis() { x = document.getElementById('myform').submit(); } </script> </body> </html>
so this is like an example i believe right
-
39 minutes ago, dsonesuk said:
????????????? remove $row['team_id']
value="' . $row['teams'] . '"
hi i kinda want it to hide
hide as in the code shows result like this
4 Chelsea Chelsea
i want the 4 to hide but still be able to be submitted.
-
hi how do i hide the (team_id) value in the below form
<option value="' . $row['team_id'] . '' . $row['teams'] . '" ' . $selected . '>' . $row['teams'] . '</option>
thanks
-
ok done did it this way just incase someone wants to know how
$query = "SELECT sss.team_id, sss.teams AS teams2, ss.team_id, ss.teams AS teams1, s.team_id, s.teams, a.current_bid, a.current_bid_id, a.id, a.team1, a.title, a.team2, a.ends, a.starts, u.nick, b.bid, b.tagged, b.bidder, b.willwin, b.quantity, p.bid As proxybid, b.id As bid_id FROM " . $DBPrefix . "bids b LEFT JOIN " . $DBPrefix . "proxybid p ON (p.itemid = b.auction AND p.userid = b.bidder) LEFT JOIN " . $DBPrefix . "sports s ON (s.team_id = b.willwin) LEFT JOIN " . $DBPrefix . "auctions a ON (a.id = b.auction) LEFT JOIN " . $DBPrefix . "sports ss ON (ss.team_id = a.team1) LEFT JOIN " . $DBPrefix . "sports sss ON (sss.team_id = a.team2) LEFT JOIN " . $DBPrefix . "users u ON (u.id = b.tagged)
-
i need to connect team1 and team2 to a table called sports so i can get there names which is in column called (teams) how do i do that i already connected sports to another table as u can see in the code, how do i go about this, thanks.
$query = "SELECT s.team_id, s.teams, a.current_bid, a.current_bid_id, a.id, a.team1, a.title, a.team2, a.ends, a.starts, u.nick, b.bid, b.tagged, b.bidder, b.willwin, b.quantity, p.bid As proxybid, b.id As bid_id FROM " . $DBPrefix . "bids b LEFT JOIN " . $DBPrefix . "proxybid p ON (p.itemid = b.auction AND p.userid = b.bidder) LEFT JOIN " . $DBPrefix . "sports s ON (s.team_id = b.willwin) LEFT JOIN " . $DBPrefix . "auctions a ON (a.id = b.auction) LEFT JOIN " . $DBPrefix . "users u ON (u.id = b.tagged)
-
yeah i understand what u saying i keep trying it but doesnt burge
-
18 minutes ago, thescientist said:
What part specifically do you need help with? It's not very clear from your post.
thansk for replying i use a tpl as frontend display, but the code above the first one cant work in tpl unless convertered this is the full code below
$query = "SELECT a.id, a.team1, a.team2, b.auction, b.bidder, b.tagged, b.willwin, b.willlose FROM " . $DBPrefix . "auctions a LEFT JOIN " . $DBPrefix . "bids b ON (b.auction = a.id) WHERE a.id = :auc_id and a.id = a.id group by 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() { $("#willwin").change(function() { $(this).after('<div id="loader"><img src="images/loading.gif" alt="loading subcategory" /></div>'); $.get('loadsubcat.php?willwin=' + $(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="willwin"> <?php if ($db->numrows() > 0){ while ($row = $db->fetch()) { ?> <option value=''></option> <option value="<?php echo $row["willwin"]; ?>"><?php echo $row["team1"]; ?></option> <option value="<?php echo $row["willlose"]; ?>"><?php echo $row["team2"]; ?></option> <?php } } ?> </select> <br/><br/> <label>Tag Bettor</label> <select name="sub_cat" id="sub_cat"></select> </form>
it only works inside php files and not tpl
below is an example of a php with tpl connector
// team $query = "SELECT a.id, a.team1, a.team2, b.auction, b.bidder, b.tagged, b.willwin, b.willlose FROM " . $DBPrefix . "auctions a LEFT JOIN " . $DBPrefix . "bids b ON (b.auction = a.id) WHERE a.id = :auc_id and a.id = a.id group by a.id"; $params = array(); $params[] = array(':auc_id', $id, 'int'); $db->query($query, $params); $TPL_team_list = '<select name="willwin" class="form-control">' . "\n"; while ($row = $db->fetch()) { $TPL_team_list .= "\t" . ' <option value="' . $row[''] . '" ' . $selected . '>' . $row[''] . '</option> <option value="' . $row['team1'] . '" ' . $selected . '>' . $row['team1'] . '</option> <option value="' . $row['team2'] . '" ' . $selected . '>' . $row['team2'] . '</option> ' . "\n"; } $TPL_team_list .= '</select>' . "\n"; { $template->assign_block_vars('tag_bidder', array( 'TEAM' => $TPL_team_list, )); $i++; }
hope u understand what am trying to accomplish
-
how do i convert this
<select name="willwin" id="willwin"> <?php if ($db->numrows() > 0){ while ($row = $db->fetch()) { ?> <option value=''></option> <option value="<?php echo $row["willwin"]; ?>"><?php echo $row["team1"]; ?></option> <option value="<?php echo $row["willlose"]; ?>"><?php echo $row["team2"]; ?></option> <?php } } ?> </select> <br/><br/> <label>Tag Bettor</label> <select name="sub_cat" id="sub_cat"></select>
to look like this
$TPL_team_list = '<select name="willwin" class="form-control">' . "\n"; while ($row = $db->fetch()) { $TPL_team_list .= "\t" . ' <option value="' . $row[''] . '" ' . $selected . '>' . $row[''] . '</option> <option value="' . $row['team1'] . '" ' . $selected . '>' . $row['team1'] . '</option> <option value="' . $row['team2'] . '" ' . $selected . '>' . $row['team2'] . '</option> ' . "\n"; } $TPL_team_list .= '</select>' . "\n"; { $template->assign_block_vars('tag_bidder', array( 'TEAM' => $TPL_team_list, )); $i++; }
i cant intergrate the above form (doesnt respond when place directly) in tpl unless converted
-
19 hours ago, justsomeguy said:
You're not printing any of those options into the select list.
This is the problem with not understanding the code you are working with. We are here to help people learn how to program. We expect people to start on their own, and make an effort. If you're not going to go through the tutorials to learn the basics about how this stuff works, how can we help you? Just doing everything for you does not teach you anything except that when you have a problem you come here to get the answer. That's not programming.
yeah true, but fixed anyway.
-
ok so after checking em am finally getting close i have them connected to one database and converted them from conn to db, the menu works fine but the sub menu disappears when i select a menu, the code below plz chk for me what am doing wrong thanks, i might not have converted all or missing a code or something
$query = "SELECT a.id, a.team1, a.team2, b.auction, b.bidder, b.tagged, b.willwin FROM " . $DBPrefix . "auctions a LEFT JOIN " . $DBPrefix . "bids b ON (b.auction = a.id) WHERE a.id = :auc_id and a.id = a.id group by a.id"; $params = array(); $params[] = array(':auc_id', $id, 'int'); $db->query($query, $params); ?> <select name="country" id="sports-list" onchange="changeSelect( this.value )"> <option value="1">Select Team</option> <?php if ($db->numrows() > 0) { // output data of each row while ($row = $db->fetch()) { ?> <option value="<?php echo $row["willwin"]; ?>"><?php echo $row["team1"]; ?></option> <option value="<?php echo $row["willlose"]; ?>"><?php echo $row["team2"]; ?></option> <?php } } ?> </select> </br></br></br><div id="subcats"> <select name="bidder" id="bids-list"> <option value='1'>Select Number</option> </select></div> <?php $willlose = mysqli_real_escape_string($_POST['willlose']); if($willlose!='') { $query = "SELECT b.*, u.nick, u.rate_sum FROM " . $DBPrefix . "bids b LEFT JOIN " . $DBPrefix . "users u ON (u.id = b.bidder) WHERE willlose=".$willlose." and b.bidder NOT IN ('b.tagged') and b.tagged IN ('b.bidder') and b.auction = :auc_id order by b.willwin"; $params = array(); $params[] = array(':auc_id', $id, 'int'); $db->query($query, $params); $options = "<option value=''>Select Name</option>"; while ($row = $db->fetch()) { $options .= "<option value='".$row['auction']."'>".$row['nick']."</option>"; } echo $options; } ?> <script src="js/dropdown/jquery-1.3.0.min.js"></script> <script> $('#sports-list').on('change', function(){ var willlose = this.value; $.ajax({ type: "POST", data:'willlose='+willlose, success: function(result){ $("#bids-list").html(result); } }); }); </script>
-
11 minutes ago, dsonesuk said:
Then I dont understand?, if you insert manually the correct value in SQL statement, it works but! if the value returned by $_POST is the same as the manually entered value it does not, that just does not make sense.
no i meant, using the previous form field, i can insert values into the table using $db without the drop down values which i iinsert maunaly from the database backend into the row, but with the $conn i can only view those values along side the drop down values. u know what is there a way i can message u the script so u see for ur self along side what am trying to do? -
4 minutes ago, dsonesuk said:
IF $db represent connection to database, what is $conn?
You just require single variable connection to a single database.
For each select statement attached to $query variable you call
$db->query($query);
directly following it and process the results following that.
IF you manually insert a value instead of a variable, does it produce correct result, if it does not then the select query is faulty.
it produces the correct result, the problem now is the script am using as u can see is different from what have been using, have tried changing things around so the script can connect to a db and not conn i have two seperate connection, db is the one have been using while conn is the one that came along with the drop menu code
-
35 minutes ago, dsonesuk said:
Should it not be
where b.willlose='.$willlose.' '
And does the values in 'willose' column have a space after the value as shown by using
.' '
on the search value?
yeah checked i remove all the b. i wasnt even joining anything, if only i could try rewrite this
require_once('conn.php'); ini_set('display_errors',0); $query = "SELECT b.auction, b.bidder, b.tagged, b.willwin, b.willlose, a.id, a.team1, a.team2 FROM " . $DBPrefix . "vs_auctions a LEFT JOIN " . $DBPrefix . "vs_bids b ON (b.auction = a.id) WHERE a.id = b.auction and a.id = a.id group by b.auction"; $country_result = $conn->query($query);
so it will look like this
$query = "SELECT a.id, a.team1, a.team2, b.auction, b.bidder, b.tagged, b.willwin, b.willlose FROM " . $DBPrefix . "auctions a LEFT JOIN " . $DBPrefix . "bids b ON (b.auction = a.id) WHERE a.id = :auc_id and a.id = a.id group by a.id"; $params = array(); $params[] = array(':auc_id', $id, 'int'); $db->query($query, $params);
so i can stay connected to my database with this config file
<?php $DbHost = "localhost"; $DbDatabase = "vsb"; $DbUser = "root"; $DbPassword = "pass"; $DBPrefix = "vs_"; $main_path = "D:\\xampp\\htdocs\\vsbet\\"; $MD5_PREFIX = "ca801ec4f5c664bc6a492f942b3a07eb"; ?>
that way i can simply intergrate the code smoothly , because right now it like am having two seperate connection acting differently
Still On submenu issue
in PHP
Posted
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
not want i want fully but still get the job done