Re: Search script problem

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

 



please keep it on the list.

Wikus Moller wrote:
> Let me repeat myself, SIMPLE, this was just the starting point.

niether 'simple' or 'starting point' equate to 'ugly' or 'shit'
though do they. even simple scripts deserve error checking and
a managable layout.

I wasn't pointing that out to make you feel bad but to give you a
leg up in better script writing ...

> 
> The error was caused due to a field being created after there were
> already rows in the table.

that *shouldn't* cause you any errors. the most likely reason it
did is your scripts assumption of the physical field order of your table.

I would recommend not using mysql_fetch_array() instead switch to
mysql_fetch_assoc() and reference the elements in the returned array
by name rather than by number - this has 2 advantages:

1. you won't get bitten by fields that were added to the table after
the script was written.
2. the output you generate using the returned array is alot more understandable:

	e.g. $row['name'] as compared to $row[0]

> 
> It works like a dream and now I will correct the errors you pointed
> out and which you assumed I didn't know and which had no relevance to
> my query after I stated so boldly that it was simple.

a. I merely assumed that you *may* not be aware of the things I pointed
out, if you are aware of those points then there was really no harm done,
if you weren't then you would have been armed some new info ...

b. you can't control the answer, only the question, stop trying :-)

> 
> Thanks

...

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux