help on simple problem

help on simple problem

am 06.11.2005 07:48:26 von baygross

all i wish to do is in php code output all rows from sql database
'listtable' and column 'name'.
I am using this code i found and adapted, but it will not work
It ouputs the right amount of lines, but is blank after Full name:

**********************************************
$sqluser="wally";
$sqlserver="localhost";
$dbase="list";
$dbtable="listtable";
$connectsql = @mysql_connect($sqlserver,$sqluser);
if (!$connectsql) { echo("Sorry, this page is not working at right now.
msql failed"); exit(); }
$selectdbase = mysql_select_db($dbase,$connectsql);
if (!$selectdbase) { echo("Sorry, this page is not working at right
now. db failed"); exit(); }

$query = "SELECT * FROM $dbtable";
$result = @mysql_query($query,$connectsql) or die("Could not submit
query");
$numrows = @mysql_num_rows($result);

for ($i=0; $i<$numrows; $i++)
{
$getrow = mysql_fetch_array($result);
echo "Full name: ".$getrow[name]. "
";
}

************************************************************ **

on a side note, i have a list of about 200 names in txt file i wish to
add to my database, is there an easy way to do this?

any help is greatly appreciated!
-BG

Re: help on simple problem

am 06.11.2005 09:01:01 von baygross

i managed to solve my first problem, actually. However, i am still
interested if any one knows how to easily add a txt file full of names
to a database...
thanks in advance!
-bg