You are here: Re: newbie newbie to php « PHP Programming Language « IT news, forums, messages
Re: newbie newbie to php

Posted by The Natural Philosopher on 09/04/07 11:27

Rik Wasmus wrote:
> On Tue, 04 Sep 2007 08:02:42 +0200, stiki <laptopia@gmail.com> wrote:
>
>> On Sep 3, 4:15 am, Erwin Moller
>> <Since_humans_read_this_I_am_spammed_too_m...@spamyourself.com> wrote:
>>> ELINTPimp wrote:
>>> >> // First run ONLY - need to create table by uncommenting this
>>> >> // Or with silent @ we can let it fail every sunsequent time ;-)
>>>
>>> >> $q = <<<CREATE
>>> >> create table pix (
>>> >> pid int primary key not null auto_increment,
>>> >> title text,
>>> >> imgdata longblob)
>>> >> CREATE;
>>> >> @mysql_query($q);
>>>
>>> > This makes babies cry.
>>
>>
>> Can someone give an example of why this is bad programming practice?
>> Is it because he is storing the image in the database?
>
>
> It's the @, and continuing on with a query one knows for sure to create
> an (sql) error again and again and again after the first time. Never
> appropriate.


well why?

I mean if you want to set for the existence of the table pseudo code
wise :-

if (table doesn't exist)
create table;

seems to me about as functionally simmilar as

try to create table, and ignore errors that it exists;

In one case the checking is explicit at the coding level, at the other
it is implicit with the mysql library. I doubt that the actual CPU
cycles differ much, and yu could argue this only requires ONE call to
the Mysql library functions, not two.

It seems to me an issue of pure style. And whether the person coming
along next says 'cunning!' or 'stupid!'

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация