Like others said, the problem could be in the printing phase itself, I'm not going to repeat here.
Since you're a beginner, I would like to comment your code and give you some hopefully useful hints.
You'll find much more information checking out Learning CGI & DBI well and with a Super Search.
First of all, your use of quotes inside a SQL string can be dangerous and unportable. For example, if $model contains a single quote, your query is doomed to fail miserably...
There are at least two easy solutions, both discussed elsewhere like I said. You can use the quote method, or placeholders. The former is a DBI method that you call passing a string, obtaining its quoted (thus safe to use in SQL) version in return. It's brilliant because it takes care of all the specific quoting methods of different databases, that's what DBI is about after all. The latter allows yuo to put ? in a SQL string where a needed value is unknown, and you can specify it later, for example at execute time. Quoting is added automagically when needed.
Then I see you're using global variables for returning your values. That's really bad practice, it doesn't matter if it's just an example. It's dangerous, wrong and can be avoided very easily.
For example, the last statement of your function could be
return $hash{key1}, $hash{key2}, $hash{key3};
and the calling code could simply use the needed local variables to store the returned values:
($field1, $field2, $field3) = function(arguments);
or, equally:
@array_of_fields = function(arguments);
Finally, never forget to use strict; and the -w switch of the Perl interpreter. Not only it helps you designing your code more clearly, it also helps you avoiding common stupid mistakes like spelling errors or using undefined variables. Simply acquire the habit. Many people (me included) do it even for one-liners, throw away scripts.
I hope this helps, even though it does not answer directly to yuor question.
-- TMTOWTDI
In reply to (OT) Re: mysql no records after space
by trantor
in thread mysql no records after space
by drivle
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |