You are here: help on simple problem « PHP SQL « IT news, forums, messages
help on simple problem

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]


Удаленная работа для программистов  •  Как заработать на 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

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