The SitePoint Forums have moved.

You can now find them here.
This forum is now closed to new posts, but you can browse existing content.
You can find out more information about the move and how to open a new account (if necessary) here.
If you get stuck you can get support by emailing forums@sitepoint.com

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

try this...

You could do it this way..

PHP Code:

function dbConnect(){ var $dbConnection = mysql_connect($hostname, $user, $pass); if ($dbConnection) {mysql_select_db ($dbName, $dbConnection); return $dbConnection; } else return false;}// The above code could sit in an include file.// You can set up some routine to check the connection works like// $db = dbConnect();// if (!$db) echo 'Lookout the database connection is dead!';// but assuming it works you can just do this whenever needed$db = dbConnect();// You should avoid using the 'All' operator (*) for speed of execution// instead, call the individual field names. You should also try to avoid using // variables inside double quotes ("$table"), instead use concatanated // single quote strings ('. $table .')$selectStatment = 'SELECT field1, field2, field3 FROM '. $table .' WHERE id=123';$recordset = mysql_query($selectStatment, $db);// If you know that it will only return one row then you can go...$rowArray = mysql_fetch_row($recordset);echo $rowArray[0] .' | '. $rowArray[1] .' | '. $rowArray[2];// otherwise you could do a loop like this...while ($rowArray == mysql_fetch_row($recordset)){ echo $rowArray[0] .' | '. $rowArray[1] .' | '. $rowArray[2] .'<br>';}

I hope this helps. This is only one way of doing this, there is another ten different ways it could be done so have a search around, you never know what you might find under some rock!