|
Posted by baygross on 11/06/05 08:48
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]. "<br>";
}
**************************************************************
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
Navigation:
[Reply to this message]
|