[freetds] Re: Parse Error on the output

Daniel Fazekas fdsubs at axelero.hu
Fri Apr 23 13:22:45 EDT 2004


On Apr 23, 2004, at 16:51, rconner at commspeed.net wrote:

> I am trying to put the data recieved from a Query into tables but It 
> seems
> to be giving me some trouble.  I get a Parse error on the 4th line 
> here.
> any suggestions?
>
> while ($arr = mssql_fetch_row($res))
>
> {
>   print ("<table border=1 cellspacing =0><tr align=center nowrap>");
>   print ("<td align=left nowrap width=180>%s</td>", $arr["0"]);

print() only takes one argument, note the difference between print and 
printf:
http://www.php.net/print
http://www.php.net/printf

It seems to be quite useless to go for printf() in such a simple case 
though.

You could simply type
print "<td align=left nowrap width=180>" . $arr["0"] . "</td>";

You'd do well to wrap the $arr["0"] inside a htmlspecialchars() call so 
people couldn't inject malicious html code into your page.

I recommend reading the PHP manual:
http://www.php.net/manual/en/index.php

That and consulting PHP forums and mailing lists instead of this 
FreeTDS list for problems such as this.

--
fds




More information about the FreeTDS mailing list