On Tue, 09 Oct 2001 20:27:07 +0200, Darko wrote:
>Hello.
>This script gives me every data  twice in print if I have database
>with
>names on database output look like this:
>
>John John Doe Doe Phone Phone 1234 1234
>
>Why?

check out the second argument to mysql_fetch_array():
http://www.php.net/manual/en/function.mysql-fetch-array.php

><?php
>  $link = mysql_connect("mysql_host", "mysql_login",
>"mysql_password")
>
>    or die ("Could not connect");
>  print ("Connected successfully");
>  mysql_select_db ("my_database")
>    or die ("Could not select database");
>
>  $query = "SELECT * FROM my_table";
>  $result = mysql_query ($query)
>    or die ("Query failed");
>
> // printing HTML result
>
> print "<table>\n";
> while($line = mysql_fetch_array($result)){
> print "\t<tr>\n";
> while(list($col_name, $col_value) = each($line)){
>  print "\t\t<td>$col_value</td>\n";
> }
> print "\t</tr>\n";
> }
> print "</table>\n";
>
>  mysql_close($link);
>?>
>
>
>
>


--
Mark, [EMAIL PROTECTED] on 10/08/2001



--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to