You are here: mysql DB help « All PHP « IT news, forums, messages
mysql DB help

Posted by Decadre on 09/28/70 11:44

I'm attempting to add some content to a site I'm tooling around with for
experience basically. I startes dabbling with php just recently. The web
host that I have has mysql space available to me, so I created a DB. I then
got this code from them that retrieves a queries and prints the data on my
site in a table.

What it's doing that has me puzzled is that it seems the data in the table
is cycling from visible to not visible. Below is the code that I got from my
webhost, and I left the variables such as user, password, etc the way they
had it so I don't give away anything. Oh the query I'm runing is different,
but I don't think that has any effect on what's happening.

here's the site where I have the code.
http://www.decadre.com/games/eq2Collect.php
<?php
/* Start of PHP3 Script */
/* Data of SQL-server */
$server= "db1.perfora.net"; /* Address of 1&1 database server
*/
$user= "xxxxxx"; /* Database username */
$password= "yyyyyyy"; /* Database Password */
$database= "dbxxxxxx"; /* name of database */
$table= "puretest"; /* Name of table, you can
select that */

/* Accessing SQL-Server and querying table */
MYSQL_CONNECT($server, $user, $password) or die ( "<H3>Server
unreachable</H3>");
MYSQL_SELECT_DB($database) or die ( "<H3>Database non
existent</H3>");
$result=MYSQL_QUERY( "SELECT * FROM $table order by name");

/* Output data into a HTMl table */
echo "<table border=\"1\" align=center width=50%";
echo "<tr>";
echo "<div color=\"#ffff00\">";
while ($field=mysql_fetch_field($result)) {
echo "<th>$field->name</A></th>";
}
echo "</font></tr>";
while($row = mysql_fetch_row($result)) {
echo "<tr>";
for($i=0; $i < mysql_num_fields($result); $i++) {
echo "<td align=center>$row[$i]</td>";
}
echo "</tr>\n";
}
echo "</table><BR><BR>";

/* Close SQL-connection */
MYSQL_CLOSE();
?>

 

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

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