can't make it work

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

lisawebs
Forum Commoner
Posts: 44
Joined: Wed Nov 19, 2003 6:21 pm

SELECT (platform issue)

Post by lisawebs »

the SELECT doesnt behave the same way in XP than in linux,

could be a configuration issue, but I'm far away that knowledge

if not, there is a platform issue regarding Mysql.
lisawebs
Forum Commoner
Posts: 44
Joined: Wed Nov 19, 2003 6:21 pm

YOU'RE RIGHT

Post by lisawebs »

when changed the comparition (in XP) to != ,the error stopped...
Since I used to store dates in yyyy/mm/dd,
it was natural to compare them in alphanum,
I prefer alphanum because can manipulate them easily.

I didn't find in mysql manual,
if a primary key can be multi-fields.
All my data model is based on dates...
microthick
Forum Regular
Posts: 543
Joined: Wed Sep 24, 2003 2:15 pm
Location: Vancouver, BC

Post by microthick »

Yes, alphanum makes sense, I guess.

Primary keys can be multi-fields. But usually you'll make your primary key some ID field, then you can make another key (though not primary) from the multiple fields.

Technically, the database won't be normalized properly, but this is the real-world, and unless you have space constraints for your database, it's more convenient to have a redundant single field primary key.
lisawebs
Forum Commoner
Posts: 44
Joined: Wed Nov 19, 2003 6:21 pm

keys

Post by lisawebs »

fields: date, unit, code
primary key: date+unit+code

I used this schema with great results
is that what you mean?

another issue about mysql SELECT:
in Linux (fine)
in XP (localhost): after deleted a record,
each time I click on "show all" buton
alternatively shows and hides the deleted record (crazy)
to avoid this I have to reload the page, wonder why is different
lisawebs
Forum Commoner
Posts: 44
Joined: Wed Nov 19, 2003 6:21 pm

more testing

Post by lisawebs »

I won't start programming until I can control I/O results
so I'm testing,

in XP, when creating records,
one after another, msg is always ok
but it only creates 1 out of 2 !!!
in twelve writes in a row (0 to 11)
when browse the dbase only 0,2,4,6,8,10 where there,
I repeated this many times and was always the same.

I even shutdown the PHPmyadmin browser
and still same results

In the copy on-line (linux) fine!

Maybe you could try my code on your XP
to compare...
microthick
Forum Regular
Posts: 543
Joined: Wed Sep 24, 2003 2:15 pm
Location: Vancouver, BC

Re: keys

Post by microthick »

lisawebs wrote:fields: date, unit, code
primary key: date+unit+code

I used this schema with great results
is that what you mean?

another issue about mysql SELECT:
in Linux (fine)
in XP (localhost): after deleted a record,
each time I click on "show all" buton
alternatively shows and hides the deleted record (crazy)
to avoid this I have to reload the page, wonder why is different
Well, date+unit+code is a fine primary key. But it's a nuisance for you to use that as your primary key. Say you have other tables in your database that need to reference that rec_ table. You'd have to use date+unit+code to create a relationship. By making a primary key called id or something, it makes doing JOINs easier. You could still have date+unit+code being a key, just not primary key.
microthick
Forum Regular
Posts: 543
Joined: Wed Sep 24, 2003 2:15 pm
Location: Vancouver, BC

Re: more testing

Post by microthick »

lisawebs wrote:I won't start programming until I can control I/O results
so I'm testing,

in XP, when creating records,
one after another, msg is always ok
but it only creates 1 out of 2 !!!
in twelve writes in a row (0 to 11)
when browse the dbase only 0,2,4,6,8,10 where there,
I repeated this many times and was always the same.

I even shutdown the PHPmyadmin browser
and still same results

In the copy on-line (linux) fine!

Maybe you could try my code on your XP
to compare...
I'm at work right now, but I should be able to try your code at home this weekend.
Post Reply