user1022585

1

votes
6

answer
338

views

php site limit clicks to a second

I have a php site which is a game, and due to the nature of the game, people spam click buttons out of impatience. I think this is causing me grief, requesting data too often from the database etc, so I thought about adding in a click limiter so they can only click once every second, or half a secon...
user1022585
1

votes
1

answer
159

views

php redirect check

Is there anyway to determine if a page has come from a php redirect? I have a session saved of the last time the page was refreshed, but i dont want it to set if the page has come from an instantly referred one. To give some idea of what i'm doing, i have this code on my site to stop users refreshin...
user1022585
1

votes
4

answer
77

views

php sql loop method

I need a query that loops data from two tables. The two tables I have are VEHICLES and VEHICLES_DB. The VEHICLES_DB table is a list of all the different types of vehicles in the database, including their speeds, picture, name, etc. The VEHICLES table is a list of all vehicles, and which member it b...
user1022585
1

votes
4

answer
5k

views

html float bottom

I want to make text float to the very bottom right hand corner of an existing tag. I'm still using old school tables (editing existing code). My code is this: KEEP UP TOP FLOAT BOTTOM The text that says FLOAT BOTTOM, doesnt obviously. How do make it so that always stays at the very bottom right cor...
user1022585
1

votes
2

answer
331

views

html fixed position IE issue

I have a chat button/link that sits at the bottom right of my page. This is my code in the css, it works perfect in firefox and chrome: a.trigger{ position: fixed; bottom: 0px; right: 15px; padding: 6px 10px 6px 10px; display: block; } In IE though, it just sits at the top of the page. How can I fix...
user1022585
1

votes
1

answer
76

views

php javascript basic line

Im trying to edit a line of code in a chat script. I know nothing about ajax or javascript I just know basic php. The line i want to edit is in a tag. xmlhttp.responseText outputs what's in chat.txt and puts it in the 'chatwindow' element. I just want it to display the date at the bottom of when ch...
user1022585
1

votes
2

answer
226

views

sql php find field value from updated row

Say I have this loop: foreach ($array as $a) { if ($a == $b) { mysql_query('UPDATE table SET this = 'that' WHERE id='$a''); } } And a table... id this blah ------------------------ 1 that 54 2 that 73 3 there 27 Inside that loop, I also want to find the value stored in the...
user1022585
1

votes
5

answer
147

views

mysql maths based query

I have a table of firearms in my game, it has 3 fields: Name dmg timer ------------------------ Pistol 5 30 Shotgun 10 45 Sniper 16 60 The timer represents how often in seconds it can be shot. Theres a lot more rows than this, but.. I want to pull them in order of ra...
user1022585
1

votes
2

answer
1.3k

views

php redirect from include file

When I add the php redirect command in an include file, it redirects just that area, in its little sub window. How can I make a redirect work with the base page? Is it even possible, because you can only redirect before the headers, can't you? Would I have to use javascript instead?
user1022585
1

votes
2

answer
47

views

recentre site design after opening right 'frame'

I have a site in PHP, the design is about 800 pixels wide and centered on the page. I want to add a chat to it, so that when it opens, it fixes to the right side of the page (about 25% wide) and pushes the rest of the page over to the left, so that my design re-centres, but now having this chat 'fr...
user1022585
1

votes
3

answer
130

views

sql order with join

i have this sql query: SELECT b.topbid, b.topdate, a.* FROM auction_items a LEFT JOIN (SELECT itemID, MAX(bid) as topbid, MAX(date) as topdate FROM auction_bids GROUP BY itemID ) b ON a.id = b.itemID ORDER BY b.topdate DESC, a.date DESC LIMIT 20 It's not ordering how i'd like it to. I want it...
user1022585
1

votes
2

answer
8.9k

views

javascript change div based on dropdown

I have a dropdown list with 2 options: Option 1 Option 2 And i want to set to display different text depending on which option is highlighted in the dropdown. How can I do this?
user1022585
1

votes
3

answer
37

views

mysql not in rewrite query issue

I have a query with NOT IN. I've heard MySQL doesn't support NOT IN, but I can't figure how to rewrite it. My query is: SELECT * FROM quests WHERE id NOT IN ('' .$quest_completed. '') AND location=' .$location_id. ' AND (follows=0 OR follows IN ('' .$quest_completed. '')) ORDER BY title eg: SELEC...
user1022585
1

votes
1

answer
106

views

SQL Inner join puzzle

I'm listing topics in my forum, using the following SQL; select t.* , lp.latestpost, lp.lpname from forum_topics as t inner join ( select p.topic, max(p.date) as latestpost, p.author_name as lpname from forum_replies p group by p.topic ) lp on lp.topic = t.id order by lp.latestpost desc LIMIT 20...
user1022585
1

votes
1

answer
56

views

SQL recordset confusing results

I have a leaderboards for my game which displays the top rankers by map in PHP from a mySQl database; SELECT name, time, MAX(score) as max_score FROM leaderboards WHERE name != '' AND hidden=0 AND map='' .$currMap. '' AND score > 0 GROUP BY name ORDER BY score DESC, time ASC LIMIT '.($get_page*...
user1022585
1

votes
1

answer
319

views

mySQL 'where name NOT IN' not working?

I have this statement: SELECT id, name FROM players WHERE this = 1 AND name NOT IN (SELECT name FROM players_online WHERE this = 'that') ORDER BY RAND() LIMIT 3, 6 All columns are correctly named. No SQL errors occur, it just returns no results. From what I've read in documentation it should wo...
user1022585
1

votes
1

answer
17

views

MySQL ordering rows by

I'm trying to pull data from my forum_topics and forum_replies tables to get the last reply date; SELECT (SELECT date FROM forum_replies WHERE topic=5 AND date < NOW() ORDER BY id DESC LIMIT 1) as lastreply, ft.* FROM forum_topics ft ORDER by lastreply DESC LIMIT 5 It's getting the lastreply data...
user1022585
1

votes
4

answer
0

views

jquery sidebar refresh too excessive?

I have 2 sidebars on my site, and due to the nature of the site (its a game script/site) certain parts of these need to be refreshed often- every 10 secs or so. On the left sidebar theres a MAIL link and an ALERTS link, both of which flash if you have new content in either. On the right sidebar, it...
user1022585
1

votes
4

answer
0

views

php string replace/remove

Say I have strings: 'Sports Car (45%)', or 'Truck (50%)', how can I convert them to 'Sports_Car' and 'Truck'. I know about str_replace or whatever but how do I clip the brackets and numbers part off the end? That's the part I'm struggling with.
user1022585
1

votes
1

answer
0

views

php array poker hand result

Im making a simple poker script in PHP and up to the point where im analysing the players hand of 5 cards. I have the hand stored in an array ($hand) like: Array ( [0] => Array ( [face] => k [suit] => d ) [1] => Array ( [face] => 6 [suit] => s ) [2] => Array ( [face] => 6 [suit] => h ) [3] => Array...
user1022585
1

votes
2

answer
0

views

sql JOINs and COUNT

Say I have this query SELECT ft.*, m.* FROM forum_topics ft INNER JOIN members m ON ft.author = m.id WHERE ft.forum = '$forum' ORDER BY ft.lastpost DESC I want to also get a row count in that from the table forum_replies where the id = ft.id. How could I do that?
user1022585
1

votes
2

answer
0

views

php form multiple input

I have a PHP page with a list of items pulled from a database. Each item has an input form next to it, and right at the bottom, a submit button. How can i do a POST check to find out which inputs have had data added? I can get the data, but how do I know the names of the particular inputs that have...
user1022585
1

votes
2

answer
4.8k

views

jquery ajax post querystring

Just getting to grips with this jquery and ajax thing. I want to run a small script on a page and I've gathered I need to use POST from a jquery function to do this. I'm having trouble sending querystrings along though, what am I doing wrong? $.post('inventory.php?use=' + drag_item.attr('id')); the...
user1022585
1

votes
1

answer
1.2k

views

jquery onclick post fetch

With jquery, I'm trying to make it so when the user clicks on a button it runs some code on another page and returns a number, which is placed into #result. This is probably wrong, but am I on the right lines? $('#button').click(function(){ $.post('getdata.php?get=a', function(data){ $('#result').h...
user1022585
1

votes
1

answer
1.8k

views

jquery drag drop - reverting current

I have a jquery UI drag and drop for an inventory. It works but i want it to not happen if my inventory already has 20 items in (if it's full). I'm not that great at javascript/jquery, I can't figure out how to fix my code to do this. I want it to revert back to it's original position if the invent...
user1022585
1

votes
2

answer
514

views

mysql multiple fields from subquery

SELECT (SELECT date FROM forums WHERE topic_id=f.id OR id=f.id ORDER BY id DESC LIMIT 1) as last_reply, f.*, p.id as pid, p.name FROM forums f INNER JOIN players p ON p.id = f.author WHERE f.topic_id=0 ORDER BY f.id DESC In the subquery, I'd like to return not only the date field, but also the a...
user1022585
1

votes
2

answer
938

views

mysql minimum int

I have this query UPDATE table SET this = this-20 WHERE this >= 0 i dont want this field to ever go under 0. Is there some addition I can add to this query to ensure this, without having to run another query? eg, if this was 18, then it would be set to -2 (USING MYSQL)
user1022585
1

votes
5

answer
99

views

jquery # scrolls to top [duplicate]

Possible Duplicate: Avoid window jump to top when clicking #-links On my site I have links that I click and jquery handles an event for them. The links are simple, eg: click The problem is, I click a link such as that, it scrolls to the top of the page (probably because of the #). Is there any way...
user1022585
1

votes
1

answer
46

views

sql query push certain records to top

Im looping through forum topics with a mySQL query, but id like records with the field sticky being 1 to always be pushed to the top, or first, then it looping through the rest. How could I do this? At the moment they are ordered like ORDER BY last_post DESC (last_post being a datetime)
user1022585
1

votes
3

answer
19k

views

javascript display value in span tag

in javascript, how can i assign and display a value to tag, so it appears in; This needs to be set on the pageload. i thought it was something like: document.getElementById('tag').innerHTML = 0;
user1022585
1

votes
4

answer
1.1k

views

php loop recordset until

In php, how can I loop a mysql recordset until ive found the criteria I need? is it just: $sql_result = mysql_query('SELECT * FROM table', $db); while ($rs = mysql_fetch_array($sql_result) && $done == 0) { if (this == that) { $done = 1; } }
user1022585
1

votes
1

answer
3k

views

jquery image border on click

Why doesnt this work? $('.char').click(function() { $(this).css('border', 'solid 2px red'); }); I want it to highlight via border when I click one of the images. Also I'd like only one to be highlighted at once but I guess I'll look at that after.
user1022585
1

votes
3

answer
76

views

sql join query issues

Im making a friends list which JOINs 2 tables, the FRIENDS table, and the PLAYERS table. friends table player target status ----------------------------- john eric invited roger moore friends stan winston friends players table name pic ------------------- joh...
user1022585
1

votes
2

answer
2.4k

views

disable jquery function for x seconds

I have an image with a jquery click attached to it and some jquery $('#action').click(function(){ alert('DONE'); }); How could I edit this so that the action function can't run for x seconds after it has ran? Say if I wanted it disabled for 5 seconds after each click.
user1022585
1

votes
1

answer
55

views

Python - Sorting huge array into multiples

I'm working with a map of which is split up into 750 x 750 numbered tiles. These are stored in a JSON file. My aim is to pull the data and split each tile into separate arrays / chunks. I already have it working, but I'm a python beginner and the code is really slow (it is handling 500,000+ numbers)...
user1022585
17

votes
4

answer
116.8k

views

javascript popup alert on link click

I need a javascript 'OK'/'Cancel' alert once I click on a link. I have the alert code: But how do I make it so this only runs when clicking a certain link?
user1022585
5

votes
3

answer
12.7k

views

jquery add onmouseover attribute

in jquery, how do I add an 'onmouseover' event to an element. eg becomes
user1022585
5

votes
2

answer
31.6k

views

jquery background color change on button click

Why doesnt this work? jquery $('#button').click(function(){ $('go').css('background-color','yellow'); }); html hello
user1022585
2

votes
2

answer
1.6k

views

jquery span tag

In my code I have this: which displays the data in the screen id, obviously. But when I change it to: or it shows nothing. Go easy on me i'm a rookie. additional info this is in my script tag in the head section: function update() { $.post('chat_new_serv.php', {}, function(data){ $('#screen').val(da...
user1022585
2

votes
3

answer
2.7k

views

php check if array values are consecutive

I have an array $dice (4,7,3,6,7) I need a way of checking if each of the values in that array are consecutive numbers. Is there an easy method of doing this?
user1022585

View additional