Hi everybody, got a small ( possible large as it's driving me bonkers lol ) problem. I'm making a stock level checking script using php/mysql. I need to make it so that the script checks each item of stock in the database and if the level of an item is below 3 print out a message. I've been at this for a few hours now trying if and while statements but just cannot seem to get my head round it. Hoping one of you good people can point me in the right direction.

Cheers for taking the time to read my post

go along those lines:

$q = mysql_query( 'select * from stock' );
while ($object = mysql_fetch_object($q)) {
  if (mycheck($object) < 3)
    echo "sell at once $object->ticker!";
}

Thanks for the reply, at least i know i'm not totally mad and going along the right path with this. Just wondering though, the line

if (mycheck($object) < 3)

What is mycheck part about????

mycheck is a method of your own to check the stock-level of your items. It is hard to make a general stock-level method so you have to provide one for your self.

Thats ok was just checking before i went and jumped in both feet first. Thanks again for the hand!!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.