April 22nd, 2003, 16:50
Hello everyone!
Well, I am not sure if I should post this hear, but I figured it was worth a shot.

I have been given the task at my work to learn PHP. Which is fine and I dont mind, but I am very new to PHP. One of the tasks they have given me is not very newbie friendly. So I was wondering if I can post my task here in hopes of getting some feedback.

Let me know and I will get right on it.


April 22nd, 2003, 17:19
www.php.net <- the online docs are great for looking up functions.

What's the project? I only know a little php but might be able to help, and i'm sure there are others here who can help too.

April 22nd, 2003, 17:21
Of course you can man! Whether or not you'll get an adequate response is another question but I'm sure we can help ya out.

Give'r :twisted:

April 23rd, 2003, 00:12
post away!

April 23rd, 2003, 20:24
Alright. Along with a ton of tasks that I am being assigned (another thread I will start here briefly), I have been given the task to learn PHP. Fair enough. I have a ton of things on my plate already, but I wont turn down a challenge or something new to learn. :)

Basically, here is what the management wants me to do:
They want me to do some PHP code that, everytime a person views our webpage, a banner of some sort will pop up on the page containing some information. Specifically, a customer, customer PIC, customer quote, employee and employee pic.

Now, where it gets interesting is that the customer will have a specific quote that will be linked to a certain employee.

The quotes will need to line up correctly with both the correct customer and the correct employee. Once that is setup, I need to setup some sort of randomizer that will display these quotes. (I hope this is making sense.)

Here is the code I have so far:

// Set arrays.

$fQuotes = array("He is very loud!", "She is a great person to deal work with.", "He knows his stuff!", "Great person to work with. Flawless.", "Really nice person. Very pleasant.");

$fCustomerID = array("Jill Paasch", "Richard Killbane", "Bao Nguyen", "Adam Smith", "Joe Dirt");

$fLoanOfficerID = array("Justin Rude", "Jeff Shaved", "Chris Bomber", "Matt Bionic", "Cynthia Woman");

// Generate random number.

// Count how many entries are in the fQuotes array, and subtract one because array entries start at 0 (should get 4)

$quotesCount = count($fQuotes) -1;

// Seed random function


// Generate the random number

$randomNo = rand(0,$quotesCount);

// Grab the random entry from the arrays

$rCustomerID = $fCustomerID[$randomNo];

$rQuotes = $fQuotes[$randomNo];

$rLoanOfficer = $fLoanOfficerID[$randomNo];

$fullquote = $rCustomerID.", ".$rQuotes.", ".$rLoanOfficer;

// Display the random quote, in verdana, and centre it.

echo "<div align=\"center\"><font face='Verdana'>";

echo $fullquote;

echo "</font></div>";


As you can see, everything is randomized. The only problem I seem to be having is making sure the correct quotes line up with the correct customer and employee.

Anyone wanna give a shot at this?
While you are, I will be starting my next thread.



April 23rd, 2003, 21:30
Does php implment Hash Tables? This would be fairly easy in perl I would think.

April 24th, 2003, 12:13
I'd throw the data into a mysql table and run a select statement to grab all the quotes for an employee. Then select a random quote from all the returned ones the way you already do. Off the top of my head, one table to relate employee to customer, another to relate employee to quotes.

By placing the data into the db, you can then grant access to the employees to update their quotes and to the boss to update what employee gets what customer. Your second task is to create the webpage through which they can do this.

April 24th, 2003, 12:18
For sure a mysql or postgress database would be the way to catagorize this. That would be the way I would tackle it as well.

April 24th, 2003, 14:01
Give'r :twisted:
Now THAT'S a NFLD expression if ever I heard one... :?:

April 24th, 2003, 14:15
Now THAT'S a NFLD expression if ever I heard one... :?:

Well... it's a Fubar (The Movie) reference but I'm sure it has particular relevance in NFLD :lol:

April 24th, 2003, 21:12
Well... it's a Fubar (The Movie) reference but I'm sure it has particular relevance in NFLD :lol:

lol - Oh yeah baby!!!

May 1st, 2003, 21:37
So did you get this resolved?

June 16th, 2003, 05:13
I'm agreeing with the other db geeks on this..
MySQL/PHP is almost definatly the way to go.

Just have the random number become the id for the row that's fetched.