|
|
|
||||
|
Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact us. |
![]() |
|
|||||||
| Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed. |
|
|
Thread Tools |
|
|
#1 |
|
Confirmed User
Industry Role:
Join Date: Nov 2003
Location: Toronto
Posts: 4,001
|
Attn PHP guys = Stupid $20 contest for stupid wannabe programmer
Ok heres the nutshell, I am trying to put together a automated accounting/inventory system for one of my projects and want to do it on my own with minimal php knowledge.
Here is how the contest works, I will ask up to 20 stupid php questions in this thread and the webmaster who provides the most 'first correct replies' gets $20 sent to their paypal or epassporte account. All 20 questions are guaranteed within one week (probably won't last more than a a couple days) otherwise the contest ends and the current winner wins. I figure I can create 20 posts getting these codes free but I guess this is a cheap ass method of giving back to all the helpers. My first question = I need the correct PHP code for the following statement: If $item_title = blah $R_Qty_1 = blah AND R_Item_1 = blah AND R_Qty_2 = blah AND R_Item_2 = blah AND R_Qty_3 = blah AND R_Item_3 = blah |
|
|
|
|
|
#2 |
|
Confirmed User
Join Date: Feb 2006
Posts: 226
|
<?php
if ($item_title=="blah) { $R_Qty_1 = blah; $R_Item_1 = blah; $R_Qty_2 = blah; $R_Item_2 = blah; $R_Qty_3 = blah; $R_Item_3 = blah; } ?> good luck
__________________
icq: 199791893 holler at me |
|
|
|
|
|
#3 |
|
Confirmed User
Join Date: Feb 2006
Posts: 226
|
if you need something coded i may do it for free in exchange for a hard link or two if you have some traffic. if ur interested, get at me on icq.
__________________
icq: 199791893 holler at me |
|
|
|
|
|
#4 | |
|
Too lazy to set a custom title
Industry Role:
Join Date: Jun 2005
Location: 127.0.0.1
Posts: 27,047
|
Quote:
and the blah's below should be in quotes too...
__________________
Make Money
|
|
|
|
|
|
|
#5 |
|
Confirmed User
Industry Role:
Join Date: Nov 2003
Location: Toronto
Posts: 4,001
|
that should do, thanks
fatdicksimon = 1 |
|
|
|
|
|
#6 |
|
Confirmed User
Join Date: Feb 2006
Posts: 226
|
whoops i missed some quotes...
<?php if ($item_title=="blah") { $R_Qty_1 = "blah"; $R_Item_1 = "blah"; $R_Qty_2 = "blah"; $R_Item_2 = "blah"; $R_Qty_3 = "blah"; $R_Item_3 = "blah"; } ?>
__________________
icq: 199791893 holler at me |
|
|
|
|
|
#7 |
|
Confirmed User
Join Date: Feb 2006
Posts: 226
|
yeah, i just caught that, thanks!
__________________
icq: 199791893 holler at me |
|
|
|
|
|
#8 |
|
Confirmed User
Industry Role:
Join Date: Nov 2003
Location: Toronto
Posts: 4,001
|
is this supposed to work even if item_title = "blah blah blah" with the spaces? i got it to work with a number without spaces but not with a line of text with spaces.
|
|
|
|
|
|
#9 |
|
Confirmed User
Join Date: Aug 2006
Posts: 268
|
Give us a better idea of what exactly you're trying to do. It gets a bit more complicated if you want to check "if title CONTAINS blah" and not "if title IS blah".
RTFM ( no offense ) - http://www.php.net/stristr |
|
|
|
|
|
#10 |
|
<&(©¿©)&>
Industry Role:
Join Date: Jul 2002
Location: Chicago
Posts: 47,882
|
wow, whole $20 for answering 20 questions?
![]()
__________________
Custom Software Development, email: woj#at#wojfun#.#com to discuss details or skype: wojl2000 or gchat: wojfun or telegram: wojl2000 Affiliate program tools: Hosted Galleries Manager Banner Manager Video Manager ![]() Wordpress Affiliate Plugin Pic/Movie of the Day Fansign Generator Zip Manager |
|
|
|
|
|
#11 |
|
Confirmed IT Professional
Industry Role:
Join Date: Nov 2005
Location: Hollywood, CA
Posts: 3,744
|
If the project takes me less than an hour to code I'll do the whole shebang for $20. (You're asking rudimentary questions so I'm guessing the project shouldn't take long.)
__________________
The Best Affiliate Software, Ever. |
|
|
|
|
|
#12 | ||
|
Confirmed User
Industry Role:
Join Date: Nov 2003
Location: Toronto
Posts: 4,001
|
Quote:
Quote:
if ($row['item_name']=="test") This doesn't if ($row['item_name']=="test test-test") I need it to be able to accept "test test-test" as the item title to lookup |
||
|
|
|
|
|
#13 |
|
Confirmed User
Industry Role:
Join Date: Nov 2003
Location: Toronto
Posts: 4,001
|
Next question is adding up all rows in a section of a field. for example, i have a field called Total_Income with rows containing numbers like 5, 20, and 9. I would like a script that displays the total income (34). If this can be based on the payment_date containing the "payment month" written down as 04:55:21 Jan 19, 2007 PST it will be two points
So basically, $query = "SELECT total_income FROM `db` WHERE payment_date **CONTAINS** Jan ORDER BY id DESC"; echo Total income = total_income_of_jan |
|
|
|
|
|
#14 |
|
Confirmed User
Industry Role:
Join Date: Nov 2003
Location: Toronto
Posts: 4,001
|
This is something that I must do myself as there is a lot of sensitive data plus I want to to be completely custom and my mind changes all the time
|
|
|
|
|
|
#15 |
|
Confirmed User
Join Date: Oct 2005
Location: St. Louis, MO
Posts: 671
|
$query = "SELECT SUM(total_income) FROM `db` WHERE payment_date='Jan' ORDER BY id DESC";
__________________
Design | SEO | Photo / Video Editing ( ICQ 49354667 ) |
|
|
|
|
|
#16 |
|
Confirmed User
Industry Role:
Join Date: Nov 2003
Location: Toronto
Posts: 4,001
|
|
|
|
|
|
|
#17 |
|
Confirmed User
Industry Role:
Join Date: Nov 2003
Location: Toronto
Posts: 4,001
|
|
|
|
|
|
|
#18 | |
|
Confirmed User
Join Date: Oct 2005
Location: St. Louis, MO
Posts: 671
|
Quote:
$query = "SELECT SUM(total_income) FROM `db` WHERE MONTH(payment_date)='01' ORDER BY id DESC";
__________________
Design | SEO | Photo / Video Editing ( ICQ 49354667 ) |
|
|
|
|
|
|
#19 | ||
|
Confirmed User
Join Date: May 2004
Location: SW Palm Bay, Florida
Posts: 1,323
|
Quote:
Quote:
|
||
|
|
|
|
|
#20 |
|
Masterbaiter
Industry Role:
Join Date: Feb 2006
Posts: 27,891
|
<? ?> ...thats how much php I know
__________________
“If you can convince the lowest white man he’s better than the best colored man, he won’t notice you’re picking his pocket. Hell, give him somebody to look down on, and he’ll empty his pockets for you.” |
|
|
|
|
|
#21 |
|
Confirmed User
Industry Role:
Join Date: Nov 2003
Location: Toronto
Posts: 4,001
|
|
|
|
|
|
|
#22 | |
|
Confirmed User
Join Date: May 2004
Location: SW Palm Bay, Florida
Posts: 1,323
|
This would probably suit your first question a little nicer:
Again, assuming you've already got the db connection established... Quote:
|
|
|
|
|
|
|
#23 |
|
Confirmed User
Join Date: May 2004
Location: SW Palm Bay, Florida
Posts: 1,323
|
http://rafb.net/p/OdT5zc28.html - Here's the same code color coded. Soon as I opened the code in my editor I noticed I missed a brace. Follow the link to the updated code. You should be able to just establish your connection after that output buffering on line 2 (haha, which I also forgot. Just add: ob_start();) and then edit those sql queries and be on your way.
|
|
|
|
|
|
#24 |
|
Confirmed User
Join Date: Oct 2006
Location: AIM: NaturalCause911
Posts: 222
|
This thread is pretty stupid.
|
|
|
|
|
|
#26 |
|
Confirmed User
Join Date: May 2004
Location: SW Palm Bay, Florida
Posts: 1,323
|
Keep your money. I've got time to help out - not in this thread to make any $.
|
|
|
|
|
|
#27 |
|
Confirmed User
Join Date: Mar 2006
Location: bizarredollars.com
Posts: 1,582
|
Spend the $20 on a book.. SAMS was one of the best investments I ever made. Knowledge = Power.
|
|
|
|
|
|
#28 |
|
see you later, I'm gone
Industry Role:
Join Date: Oct 2002
Posts: 14,196
|
Well, (and not picking on any one in particular, so far all answers 2 have this problem) using the contains Jan works fine if we only have one years data in the db, otherwise we are going to get multiple years worth of data totalled.
(using Calm's statement as base) $Total= mysql_result(mysql_query("SELECT SUM(total_income) AS Total FROM `db` WHERE payment_date LIKE '%Jan%' and payment_date like'2007'"),0); However, it would be better to store the date in a proper date field and be able to hit it with a between function.
__________________
All cookies cleared! |
|
|
|
|
|
#29 |
|
see you later, I'm gone
Industry Role:
Join Date: Oct 2002
Posts: 14,196
|
Well, at 4 in the morning I do. lololol.
Just woke up, time for coffee.
__________________
All cookies cleared! |
|
|
|
|
|
#30 |
|
Moo Moo Cow
Join Date: Mar 2004
Location: Washington State
Posts: 14,748
|
Hello World
|
|
|
|
|
|
#31 |
|
Confirmed User
Join Date: Oct 2006
Location: AIM: NaturalCause911
Posts: 222
|
SELECT SUM(TotalPrice) AS [TotalPrice], COUNT(OrderID) AS [Sales], MONTH([Date]) AS [Month], YEAR([Date]) AS [Year]
FROM [Order] WHERE OrderStatusID = 4 -- Complete GROUP BY Month([Date]), YEAR([Date]) I just wrote that, nice and simple and it tells me how much ive made for each month of each year |
|
|
|
|
|
#32 |
|
Confirmed User
Join Date: May 2004
Location: SW Palm Bay, Florida
Posts: 1,323
|
|
|
|
|
|
|
#33 |
|
Industry Role:
Join Date: Aug 2006
Location: Little Vienna
Posts: 32,235
|
When i need to found out something about php then i got php forums,i always found answer about php there.
|
|
|
|
|
|
#34 |
|
So Fucking Banned
Join Date: Oct 2003
Location: In a house.
Posts: 9,465
|
I would also recommend you get a decent PHP manual... I have an older one here from SAMS that is pretty good, there are any number of decent PHP references with examples out there. The PHP website is quite good too, although sometimes a little less than encouraging!
|
|
|
|
|
|
#35 |
|
Confirmed User
Join Date: May 2002
Location: European Union
Posts: 3,815
|
For the small chance that all the "blah"s are the same value you can also use
<?php if ($item_title == "blah") { $R_Qty_1 = $R_Item_1 = $R_Qty_2 = $R_Item_2 = $R_Qty_3 = $R_Item_3 = "blah"; } ?> (Correct me if I'm wrong) |
|
|
|
|
|
#36 |
|
Confirmed User
Join Date: May 2004
Location: SW Palm Bay, Florida
Posts: 1,323
|
There is no such thing as a single right answer in programming.
It's all about semantics and pragmatism : - ) |
|
|
|