Jump to content


Photo

processing database records


  • Please log in to reply
1 reply to this topic

#1 geekwannabe

geekwannabe
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 02 October 2006 - 11:24 AM

Whats the standard technique for walking through a database and processing each record? 

It seems that I need a php script that generates a php script.  But then how do I get it to call the script created and then return to the originating script and continue processing.  This kind of scenario was not a problem in Foxpro, the language I am most familiar with.  I tried setting up an odbc connection and doing the processing from foxpro.  That method has serious performance problems!


#2 thedarkwinter

thedarkwinter
  • Members
  • PipPipPip
  • Advanced Member
  • 191 posts
  • LocationLondon

Posted 02 October 2006 - 01:48 PM

Hi

im afraid im only familiar with mySQL connections  - but something like this may be helpful



$host = "localhost";
$user = "??";
$pass = "??";

mysql_connect($host,$user,$pass);
mysql_select_db("mydb");

$SQL = "SELECT * FROM mytable;";

$result = mysql_query($SQL);
while ($row = mysql_fetch_row($result))
{
  echo $row[0] . $row[1];
}
Remember - if you don't figure it out yourself, you'll probably forget it tomorrow :)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users