![](https://forums.phpfreaks.com/uploads/set_resources_1/84c1e40ea0e759e3f1505eb1788ddf3c_pattern.png)
Canman2005
-
Posts
669 -
Joined
-
Last visited
Never
Posts posted by Canman2005
-
-
Well that advert didnt help
any ideas anyone?
-
Hi all
I have the following QUERY
SELECT * FROM product_category_associations INNER JOIN products ON product_category_associations.product_id = products.id AND products.date_available <= '2008-11-05' WHERE products.product LIKE '%Sample%' AND `december` !=0 AND product_category_associations.live =1 GROUP BY `linked_id` ORDER BY product_category_associations.live DESC
It returns something similar to
`product` `linked_id` `live`
iPod Nano 232 1
iPod Classic 112 1
there is one more row in the database, but as it has a `live` value of 0, then it does not display (but for the record that row is)
`product` `linked_id` `live`
iPhone 232 0
If you notice, the 'iPhone' and 'iPod Nano' share the same `linked_id` (232) but because the 'iPhone' has a `live` value of 0 it's not returned in the main QUERY.
How can I alter my QUERY so that if the database finds that any rows with indentical `linked_id` values, and either of them have a `live` value of 0, then they won't display either, so in this case, because the `iPhone` has the same `linked_id` as the `iPod Nano`, but the `iPhone` has a `live` value of 0, then it won't display either of those rows, so if I ran the main QUERY again, it would just return
`product` `linked_id` `live`
iPod Classic 112 1
Can anyone help?
Thanks
-
Sorted, thanks anyone who read this
-
Hi all
Quick question, if I post
myfile.php?qty=30
how can I get whatever I place between
{
}
to loop, such as a query or print statement
-
If I get it disabled, could it effect anything else?
Also, if I get it disabled, would I need to go and manually remove all slashes or would strip slashes sort that out?
-
For posting
$data = mysql_real_escape_string($_POST['datafield']);
for printing
print stripslashes($recentitemsrow['data']);
but it still seems to leave tons of slashes
-
when posting data or when displaying data?
-
Hi all
I am using
mysql_real_escape_string
when posting any data from a form to a QUERY, but I am getting an increasing number of slashes appearing, sometimes as many as 7 or 8 of them per value.
I am using strip the php strip slashes funtion to remove them, but it does seem to be leaving some values with slashes in them
How can I strip all slashes?
thanks
-
Okay, I have managed to track down and mod a script, it's
<script type="text/javascript">
var posx;
function getMouse(e){
posx=0;
var ev=(!e)?window.event:e;//IE:Moz
if (ev.pageX){//Moz
posx=ev.pageX+window.pageXOffset;
}
else if(ev.clientX){//IE
posx=ev.clientX+document.body.scrollLeft;
}
else{return false}//old browsers
document.getElementById('myspan').firstChild.data='X='+posx;
}
document.onmousemove=getMouse
</script>
<span id="myspan"> </span>
This seems to give the X coordinates, but I am having problems doing two things;
1: Attaching it to a form button, so that it only read the X coordinates on that button
2: Also, if you move you mouse quickly from right to left, rather than X coordinate resetting back to 0, it seems to stay on higher numbers, for example, I moved the mouse very fast from right to left and it went from a X coordinate count on the far right of 987 to 123 when it was as far left as it could be. Any reason for that?
Any help would be appricated everyone
-
thanks, have had a quick look and it doesnt really make much sense, I am not a javascript coder.
any other help and advice would also be appricated
thanks
-
Still doesnt seem to return correct, the pc score should return within the value of 100 and I have some returning as 180.7775 for example
Should I give up?
-
Hi all
I have a form button which looks like
<input type="image" src="images/longbar.gif" width="400" height="30"
What I want to try and do is to display (as HTML text) above this button what position the mouse is within the button, so having a number chart going from 1.0 1.1 1.2 .... upto...... 9.8 9.9 10.0
So if someone put their mouse in the middle of this button, it would display 5.0 and if they place it at a 1/4 of the way along, it woud display 2.5 and so on.
Is this possible? Can anyone help me? I'm a total ZERO when it comes to JScripting, so could really do with a hand.
Thanks very very very much
-
I get
#1140 - Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause
-
Still majorly stuck, is there a way to do this or am I trying to achive the impossible
-
hummm, that didnt seem to work either, so you know my code, I have the following
$maxres = mysql_query ("SELECT SUM(score) AS totalScore FROM people GROUP BY name ORDER BY totalScore DESC LIMIT 1");
Which works perfect, then I have the following
$max = mysql_result ($maxres,0); $sql = "SELECT name, score, score*100/$max as pc FROM people ORDER BY score DESC LIMIT 10"; $res = mysql_query($sql); while (list($name, $score, $pc) = mysql_fetch_row($res)) { printf('% (%0.1f<br>', $score, $pc/10); }
Which works and currently goes and returns everything in `score` order with a point score going from
0
0.1
0.2
.........
9.8
9.9
10.0
But what I want to do is to get it to group up anyone with the same `name` but adding their `scores` up and then returning a point score.
Does that help at all?
Thanks very much for all the help so far
-
I only ask because before the pc value was coming back at around
85.43
65.21
34.54
and now it's being returned as
171.6049
145.4324
90.6655
I need to try and get the pc score to be 100 or less than 100
any ideas how I can?
-
Just one question, where in the QUERY would I define the $max value?
-
I think that has done is Mark, thanks mate
-
Similar to the last question, but I have this QUERY
SELECT name, score*100/$max as pc FROM `people` ORDER BY score DESC
Which basically returns
David 300
Bryan 200
David 150
Susan 120
How can I do the same and count the total score for anyone with the same `name` so the result for that data would be
David 450
Bryan 200
Susan 120
But it would need to retain the part of the Query
score*100/$max as pc
as that is used later on in the code to work out an average score, but I need to try and group anyone with the same `name` together but adding up their `score`
sorry its a bit vague
any help would be wicked
thanks
-
Cool thanks man, have another question along the same lines
-
Hi
I have a few questions, but i'll take it one at a time, firstly, have a table called `people` which looks like
At the moment i'm using
SELECT MAX(score) FROM `people`
with that data it gives me 300 at the moment.
I want to do the same Query but count duplicates with the same `name`, so if I did this Query then it would return the value 450 as David has 2 entries and added together they eual the highest value.
Any help would be ace
Thanks
-
Hi all
Wondering if someone can help me.
Basically I have a form which has 2 fields
Numbers (which on the form is called `number`)
Real Number (which on the form is called `real_number`)
I then have a price (which on the form is called `cost`)
What I want to do is if in the number field there is the value 100 and the price value is 5 and someone enters into the real number the value 200, then it would calculate the price at 10
Again, if the number value was 1 and the price was 15 and the real number value was changed to 2 then the price would increase to 30
If for example the number value was 50 and the price was 10 and the real value number was changed to 25 then the price would come out at 5
Does that make sense?
Can anyone help?
-
Hi all
I have a quick PHP job is anyone is about right now, get me on MSN
markystuart@hotmail.com
I may appear offline, but I am online
-
getting knowhere fast with this one, has anyone got any ideas?
sorry to multi post
Query Help
in MySQL Help
Posted
Can anyone help? Still trying to crack this one