« first day (26 days earlier)      last day (303 days later) » 

01:19
@MayankVadiya do you want to do it in php or what?
anyone here?
+help
01:32
Anyone here?
@DonYungerKman yes have you been here before?
@overexchange fine i would say
@DonYungerKman if not please read the rules
02:29
I understand and will obey all rules.
is someone around that could help me with MySQL here?
@DonYungerKman thank you and yes i would be glad to help
I am making a website and the users are able to open something known as packs on the website and the pack contains virtual players.
These players are held in a MySQL database
I am doing weighted randoms so I do order by cardweight/rand() desc
Each player has a value that is generated
and all the values of every player in the pack is combined to give a total
is it possible to make a query where it grabs players randomly based on their weight as well cap the maximum total pack value (so the value of all players together)
?
Would appreciate if there is a solution
02:44
Any idea? @JackSmith
i am here i was gone for a few mins @DonYungerKman
what does your table look like? @DonYungerKman
Hold
on
the prices of each player or item is held in the ps3bin, psbin, 360bin, xboxbin
depends on the user account who is opening the pack
so I would just change the query dynamically depending on which
03:03
ONE MIN
ok thanks
that is a huge table :)
so you want a query to select a random pack right @DonYungerKman
Okay say for example
they're opening a pack could the triple IF pack
I do this
03:06
have to eat dinner be back
in about 15 mins
$player1query = "select * from my_players where player_type = 'IF' order by cardweight/rand() desc limit 1"
ok
hi guys
@DonYungerKman that is what you have right now
@Ricardo hi
are you familiar with bootstrap modal dialog?
03:20
@Ricardo i am familiar with bootstrap what is your problem?
@DonYungerKman you can take a look at this: stackoverflow.com/questions/19412/…
I'm having a hard time on bootstrap modal dialog.
am a bit confused
cause I have a table and it has an edit button wherein it will show up a modal dialog once clicked. so basically what's inside the modal is an edit form
my problem is I that when I clicked on the save button in the modal dialog, there's no changes happening in the table
@DonYungerKman you want to select a random row right
@Ricardo just post your problem :)
@Ricardo is it a mysql table
wait
it's an html table which has records that's retrieved from mysql database
03:26
ok so it does not update the database
if the table is not updating then the database must not be updating
yes exactly
code please @Ricardo
@DonYungerKman you still here?
wait I've already posted my problem on SO
can I post it here?>
wait
I'll post it here
my code
so this is my modal code together with the php script
<?php

if(isset($_POST['submit'])){

$firstname = $_POST['emp_fname'];
$middlename = $_POST['emp_mname'];
$lastname = $_POST['emp_lname'];
$birthdate = $_POST['emp_bday'];
$gender = $_POST['emp_gender'];
$maritalstatus = $_POST['emp_maritalstatus'];

$query = $mysqli->query("UPDATE tbl_employee SET emp_fname = '$firstname',
emp_mname = '$middlename',
emp_lname = '$lastname',
emp_bday = '$birthdate',
emp_gender = '$gender',
emp_maritalstatus = '$maritalstatus'
WHERE emp_id = '$emp_id'");
if($query){
(see full text)
-----------------------------this is my code for the table---------------------------------
<br>
<button type="button" class="btn btn-info btn-sm pull-right" data-toggle="modal" data-target="#myModal1">Edit</button>
<div class="clear text-primary bold"><i class="fa fa-user text-primary"></i> Basic Information </div>

<br>

<section class="padder-v">
<table class="table table-responsive">
<tbody>
<tr>
<th>
<strong> Employee ID</strong>
</th>
<td>
<p class="text-muted"><?php echo $_SESSION['emp_code']; ?></p>
</td>

<th>
<strong> Birthdate</strong>
</th>
<td>
<p class="text-muted"><?php echo $_SESSION['birthdate']; ?></p>
(see full text)
why don't you just do
if(!empty($_POST)){} ?
ok I'll try that one
wait this is the error that I got: Notice: Undefined variable: mysqli in
Fatal error: Call to a member function query() on null in
03:36
also I suggest this DB class
it's better to use than the general php one
@Jack
@JackSmith are you here?
Was wondering if anyone knew of a good resource for Arduino C language
@DonYungerKman yes
@r3wt sorry don't know Arduino C language but please read the rules at: yourphotomake.info/rules
ok Jack
this is what am trying to do
open I have a pack called the Triple Inform Pack
this contains three players/items
from that database table that I showed you
I grab three players
based on weighted randoms
so I run these queries to get the three players
$player1query = "select * from my_players where player_type = 'IF' order by cardweight/rand() desc limit 1";
$player2query = "select * from my_players where player_type = 'IF' order by cardweight/rand() desc limit 1";
$player3query = "select * from my_players where player_type = 'IF' order by cardweight/rand() desc limit 1";
so that would grab three players for the inform pack
but I would like to create a more sophisticated query
so it would select three players where the player_type is IF
but the total value of all three randomly picked weighted players should total up to a certain amount or less
so for eg
selecting three players where the player type is IF and either the psbin, xboxbin, ps3bin or 360bin totals up to 250000 or less
in this instance lets just work with psbin
03:52
so do you already have a query and you are getting a error or you want me to write one
sorry if i am not understanding
@DietherSilverious please read the rules: yourphotomake.info/rules
I already have a query it's working but I would like to improve it to involve the other things I just said so if you could help me write this one which more sosphisticated
so in others word the new query should contain this then
select * from my_players
where player_type = 'IF'
get 3 rows
the 3 rows should be rand() selected in relation to it's weight (cardweight column)
and the 3 pick should not total together more than 250000
the 3 rows picked*
the total is based on the psbin column
so this is your query right:
$player3query = "select * from my_players where player_type = 'IF' order by cardweight/rand() desc limit 1";
yeah currently
I would do that three times to get three players for the pack
04:10
please forgive me if i am wrong or ask any dumb questions @DonYungerKman
but you want to get 3 rows right @DonYungerKman
if so this would be the query
$player3query = "select * from my_players where player_type = 'IF' order by cardweight/rand() desc limit 3";
yes I know but I need a sosphisticated query like I said
which would do that as well
but then
ok for example
it does a limit of 3
I get back
Player A, Player B, Player C
Player A's psbin may be 300000
Player B's psbin could be 40000
and Player C psbin could be 92000
is there a way of capping it
so you said select 3 where they're a IF player type all random and weighted
but cap it so players are max upto 250k combined
04:28
ok i am starting to get what you are say now i think@DonYungerKman
so you want to get all players as long as all there psbin is not over 250k right? @DonYungerKman
no
their combined psbin
so combined
for all three is 250000
so one may be 120k then another 90k then another 40k
but you would never get over 250 000 in psbin combined
guys why am I getting this error? Fatal error: Call to a member function fetch_assoc() on boolean in C:\xampp\htdocs\modal-update\getdata.php.....
here's my code
<?php
include "config.php";
$res = $mysqli->query("SELECT * FROM person");

while($row = $res->fetch_assoc()):
?>
<tr>
<td><?php echo $row['id_person']; ?></td>
<td><?php echo $row['firstname']; ?></td>
<td><?php echo $row['lastname']; ?></td>
<td><?php echo $row['age']; ?></td>
<td><?php echo $row['hometown']; ?></td>
<td><?php echo $row['job']; ?></td>
@DonYungerKman yes that is what i mean
@Ricardo try this: fetch_assoc($res);
@DonYungerKman np
04:36
ok thanks
still not working
@Ricardo try this mysqli_fetch_assoc($res)
7
Q: Fatal error: Call to a member function fetch_assoc() on a non-object

nicklesI'm trying to execute a few queries to get a page of information about some images. I've written a function function get_recent_highs($view_deleted_images=false) { $lower = $this->database->conn->real_escape_string($this->page_size * ($this->page_number - 1)); $query = "SELECT image_id, ...

ok thanks
got to go
be back tommorow @DonYungerKman @Ricardo
04:59
hello guys
happy sunday
 
11 hours later…
15:31
@SagarNaliyapara hello
@DonYungerKman you here
@Ricardo you here?
15:47
Hello
@JackSmith
What's up dude???
16:12
@SagarNaliyapara nothing
Hey am here now
@JackSmith you there?
@DonYungerKman yes i am here
Ok
Was you able to come up with a solution or did you not get what I mean't
i got what you meant @DonYungerKman
16:25
want to select players where the psbin combined is not over 250k
right?
@DonYungerKman
yes
that's correct
ok great @DonYungerKman
Ok do you think that is possible?
let me see
@DonYungerKman
i think so
16:36
is the psbin a int @DonYungerKman
ok
give me a few mins @DonYungerKman
17:04
any luck?
@JackSmith
@DonYungerKman not yet give me some more mins
please
can you give me the create statement for your table please
you can see how to get those from here:
51
Q: How to generate a create table script for an existing table in phpmyadmin?

Marko CakicHow can I generate a create table script for an existing table in phpmyadmin?

@DonYungerKman
run this in your phpmyadmin sql statement
SHOW CREATE TABLE tablename
@DonYungerKman
i think i might have it :) @DonYungerKman
@DonYungerKman you here?
try this:
SELECT *
FROM my_players, (SELECT @psbin := 0) x
WHERE player_type = 'IF'
AND (@psbin := @psbin + psbin) <= 250000
ORDER BY RAND();
17:21
Ok I will try this
I will change slightly
as it's weighted randoms
so cardweight / RAND()
ok
@DonYungerKman if it works can you give me a few up votes?
@Sqnkov hi
hey there @JackSmith
can you upload image right into here it is not showing on Gyazo
never mind it is working
@DonYungerKman
can you give me the create table sql statement please
CREATE TABLE `my_players` (
`myplayer_id` int(11) NOT NULL AUTO_INCREMENT,
`player_id` int(11) NOT NULL,
`First_Name` varchar(255) NOT NULL,
`Last_Name` varchar(255) NOT NULL,
`Rare` varchar(255) NOT NULL,
`Foot` varchar(255) NOT NULL,
`Height` varchar(255) NOT NULL,
`Date_Of_Birth` varchar(255) NOT NULL,
`player_name` varchar(255) NOT NULL,
`player_nation` int(11) NOT NULL,
`player_club` int(11) NOT NULL,
`player_league` int(11) NOT NULL,
`player_type` varchar(255) NOT NULL DEFAULT 'GOLD',
`player_pos` varchar(255) NOT NULL,
(see full text)
thank you
can you give me a few insert statement so i can construct on my computer
17:35
INSERT INTO `my_players` (`myplayer_id`, `player_id`, `First_Name`, `Last_Name`, `Rare`, `Foot`, `Height`, `Date_Of_Birth`, `player_name`, `player_nation`, `player_club`, `player_league`, `player_type`, `player_pos`, `totwImage`, `psbin`, `xboxbin`, `ps3bin`, `360bin`, `xmin`, `xmax`, `pmin`, `pmax`, `cardweight`, `definitionId`, `resourceId`, `player_added`, `player_status`, `player_rating`, `Attribute1`, `Attribute2`, `Attribute3`, `Attribute4`, `Attribute5`, `Attribute6`, `available`) VALUES
(see full text)
thanks
17:50
try this:
SELECT *
FROM my_players, (SELECT @psbin := 0) x
WHERE player_type = 'IF'
AND (@psbin := @psbin + psbin) <= 250000
ORDER BY RAND();

SELECT psbin FROM my_players;
@DonYungerKman take a look at the sql fiddle
but I need not just the psbin
I need all the player info
to come out with that
and it is exactly right is it?
less than 250000
but then I am seeing 3M+ values and stuff?
the only query that is working is this
SELECT psbin FROM my_players;
which is getting every psbin
not this
SELECT *
FROM my_players, (SELECT @psbin := 0) x
WHERE player_type = 'IF'
AND (@psbin := @psbin + psbin) <= 250000
ORDER BY RAND();
take a look at this one please
it should work
@DonYungerKman
yeah works
but isn't working in SQL section of phpMyAdmin :/
let me test in a php script
18:06
yeah nothing
can you show be what you are doing
18:22
@JackSmith
hmm strange
when I create a table using the query that is from the SQLfiddle
and then run the query it works on that table
did you modify anything
@JackSmith
okay it's working in some ways
if it is set at <= 250000
it doesn't work
if I make it like 3000000
why does it?
when there is still like 59000
121000
63000
18:41
be back in 1 hour
 
2 hours later…
20:46
hello @JackSmith
hello @NiKoLaPrO
hello @lyndact
:D
i had gotton suspended so i could not come
can you add me as owner
why? :o
idk, ask @JackSmith
he's the man
20:48
@JackSmith, howo i can run js script with php in url like www.example.com?text=hello world!
i want to run it here
i created cowsay but i want to make it say something when add ?text=
but i dont know how to do it
that can be done only with php?
@NiKoLaPrO you can just assin a php variable to a js variable
then add the php variable to the url
and that cowsay is nice can you start NBOT to
and what is CBOT? @NiKoLaPrO
21:41
Greetings PHPers!
 
2 hours later…
23:19
@JackSmith you there?
23:37
i am back @JackSmith

« first day (26 days earlier)      last day (303 days later) »