Re: Help with MySQL Logic

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



What about two tables, one would have this:
carID
carCompany
carPayload
etc...

the second this:
position
carID

This table would be static and if a car was not present in certain conditions 
they would contain (-1) for the carID.  Then finding an empty slot to place an 
incoming car should be doable (stepping through to find (-1), and when a car is 
removed from a slot, then you could update the list, just dump out 
the 'current' order into an array, and then you would be able to sort, order, 
etc...

Hope this makes sense.
-Brad

> Heh. Sounds like a programming class homework project.
> I would say through the clever use of where clauses's, like:
> 
> UPDATE position SET posistion = (position-1) WHERE position >
> $idremoved;
> 
> Would work, assuming $idremoved containted the position of the car
> removed.
> 
> On Mon, 2003-03-03 at 10:59, Rankin, Randy wrote:
> 
>     Hello All,
>     
>     This may be a bit off topic. If so, my apololgies. 
>     
>     A client of mine, a rail car storage company, has asked that I
>     create a
>     PHP/MySQL application in which they will maintain and track rail
>     cars. I am
>     having a bit of trouble however working through one of thier
>     requirements.
>     They need to know in what position the rail car is on each track.
>     For
>     example, they might have a track called X which will hold 30 rail
>     cars. They
>     would enter the car information for 30 cars and associate each of
>     them with
>     track X. If one of the car owners decides to move car 3 out of
>     storage, then
>     the remaining 29 cars must be re-numbered ( ie; car 1 and 2 would
>     remain and
>     car 4-30 would become car 3-29 ). In the same manner, I need to be
>     able to
>     add a car to the track once an empty slot is available. For example,
>     If the
>     new car goes at the front of the track then it would become car 1
>     and the
>     remaining cars, originally numbered 1-29 would become 2-30. 
>     
>     I hope I explained thourougly. Any suggestions would be appreciated.
>     
>     Randy
> 
> -- 
> Adam Voigt (adam@cryptocomm.com)
> The Cryptocomm Group
> My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc
> 






-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux