Closed Thread Icon

Topic awaiting preservation: problems with mysql database (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=12970" title="Pages that link to Topic awaiting preservation: problems with mysql database (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: problems with mysql database <span class="small">(Page 1 of 1)</span>\

 
sabina
Obsessive-Compulsive (I) Inmate

From: franc paris
Insane since: Oct 2003

posted posted 11-05-2003 13:27

I am writing this code

<html>

<head>
<title></title>
</head>

<body>

<?php

$link = mysql_connect("localhost", "administrator", "")
or die ("Could not connect to MySQL");

mysql_select_db ("test")
or die ("Could not select database");
$query = "SELECT * FROM votimi";
$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";
echo $col_value;
}
print "\t</tr>\n";
}
print "</table>\n";

?>

</body>

</html>

I am riciving this

3 3
4 4
5 5
5 5
5 5

but my database in mysql loks like this


votat
-----
3
4
5
5
5


the answer is why i am reciving two colums
i want to recive one column like in mysql


lklkjlkj

Tyberius Prime
Paranoid (IV) Mad Scientist with Finglongers

From: Germany
Insane since: Sep 2001

posted posted 11-05-2003 13:50

well, you are printing $col_value twice...

drop the echo, that should work...


print "\t\t<td>$col_value</td>\n";
echo $col_value;

so long,

Tyberius Prime

« BackwardsOnwards »

Show Forum Drop Down Menu