GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   PHP / MySQL Help! (https://gfy.com/showthread.php?t=237920)

galleryseek 02-17-2004 01:01 AM

PHP / MySQL Help!
 
ok just a few questions, unfortunately my coder is a fatass lazy piece of shit so i'm attempting this, if you can prove helpful i'll use you on the project.. its just a big move to remove the current programmer cause this is such a big ass project... anyhow...

This is a table that I'm currently working with.
http://www.bodygain.com/gfypics/table.gif

What I want to do is print out, "You have performed X amount of Exercises"... the initial coding i assume would go like this:

$query = "SELECT abrv FROM bgusers WHERE uid=$uid";
$result = mysql_query($query);

then how do you take the $result and exclude the duplicates then find out how many individual exercises there are after duplicates have been removed? i assume there is some kind of duplicate removing function in php...

I assume this isn't too difficult for most coders out there...

thx ;)

sixxxth_sense 02-17-2004 01:05 AM

I'm a coder and i'm 2 lazy to read the post!
So i'll give her a bump, it looks eazy

fuzebox 02-17-2004 01:05 AM

Change your query...

$query = "SELECT abrv, count(*) AS total FROM bgusers WHERE uid=$uid" GROUP BY abrv;
$result = mysql_query($query);

Now when you mysql_fetch_array() or whatever your $result, you'll get a $result["abrv"] and a $result["total"] for each excercise.

Cheers :glugglug

SMG 02-17-2004 01:06 AM

its faster if you just do it with the mysql using the distinct keyword
$query = "SELECT DISTINCT abrv, count(*) AS total FROM bgusers WHERE uid=$uid" GROUP BY abrv;

fuzebox 02-17-2004 01:10 AM

Quote:

Originally posted by SMG
its faster if you just do it with the mysql using the distinct keyword
$query = "SELECT DISTINCT abrv, count(*) AS total FROM bgusers WHERE uid=$uid" GROUP BY abrv;

pfft

SMG 02-17-2004 01:11 AM

lol I pasted from the wrong post but I guess it still works, however that " at the end of the select line should be moved to the end of course...

woj 02-17-2004 01:12 AM

Is it just me or is that table really poorly designed?

johnbosh 02-17-2004 01:14 AM

Quote:

Originally posted by woj
Is it just me or is that table really poorly designed?
not me

Voodoo 02-17-2004 01:16 AM

PHP Code:

function contactTechSupport$call "1-888-TECH-SUP";) if($mysql != "work"){  contactTechSupport(); } 


SMG 02-17-2004 01:18 AM

Quote:

Originally posted by woj
Is it just me or is that table really poorly designed?
heh, I'd like to know whats up with that data column ... but then again maybe it doesnt require indexing ever on that so it might be fine

galleryseek 02-17-2004 01:31 AM

thx for the help.. but im still having fucking problems...

$query = "SELECT DISTINCT abrv FROM bgexercises WHERE uid=$_SESSION[userid]";
$resultss3 = mysql_query($query);
$shit = mysql_num_rows($resultss3);
print "$shit";

and its not printing dick.

i didn't use all of your guys's coding cause i tried it and it didn't work.. all i'm trying to do is get how many different exercises there are n' thats it... god damn i hate this shit :winkwink:

galleryseek 02-17-2004 01:34 AM

ooops! i was using "uid" instead of "userid". ;) it works now....

galleryseek 02-17-2004 01:48 AM

okay.. heres the next one, its a lot more complex... i want to do something like this:

"You have GAINED STRENGTH on over 2 different exercises within the past MONTH "

this focuses specifically on the "data" field. we figure out the strength increase by this formula (using the first row from the picture up top):

(35 * 15 + 50 * 10 + 80 * 8) / 3

now what we'd have to do is somehow be able to group the strings according to ABRV, and compare "data" from 1 month ago of each exercise, to NOW... and determine if there has been a strength gain.. then print the results.

LOL, sounds like a bunch of shit.. thought i'd post it anyhow... if someone can get it right i'll paypal $30 if that'll raise incentive. :) if you're interested & need more specifics.. just post.

Alky 02-17-2004 01:50 AM

(35 * 15 + 50 * 10 + 80 * 8) / 3

thats a formula?

Mr. Porno King 02-17-2004 01:59 AM

Give me a bit more data on ICQ, and I'll write the code you need within the hour. 172884621

JDog 02-17-2004 02:03 AM

If you want, contact me, I could help out with MYSQL/PHP. I've done the NSCash & ReelProfits affiliate area add-ons!

jDoG

JDog 02-17-2004 02:05 AM

Quote:

Originally posted by woj
Is it just me or is that table really poorly designed?
Yea I think so too! I don't like the design, but hey! I don't have a say! :)

jDoG

Karlitos 02-17-2004 08:54 AM

btw, it looks like PhpMyAdmin table when you get the result of a query!:glugglug


All times are GMT -7. The time now is 12:32 AM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123