well, another problem.
I've tweaked my code a little bit (some of it was wrong as you noticed).
The problem: infinite loop. The rest of the code is fine...
BTW: the die(...) errors are in Hebrew.
The program prints 111111111111111111111... (the content of "Acid").
Code:
<?php
/*--------------------------------------------------------------------
Settings File
--------------------------------------------------------------------*/
// DB Settings
define("MySQL_Server","localhost"); //MySQL Server
define("MySQL_Username","root"); //MySQL Username
define("MySQL_Password",""); //MySQL Password
define("MySQL_DB_Name","blabla"); //MySQL DB Name
/*--------------------------------------------------------------------
Global Functions
--------------------------------------------------------------------*/
function DBConnect($Q)
{
$MySQL_Link = mysql_connect(MySQL_Server, MySQL_Username, MySQL_Password) or die("שגיאה"); //MySQL Connection
//Connection check
$MySQL_DB_Selection = mysql_select_db(MySQL_DB_Name, $MySQL_Link) or die("שגיאה 2");
//Query
$MySQL_Q=mysql_query($Q,$MySQL_Link) or die("שגיאה 3");
Global $MySQL_Row;
$MySQL_Row=mysql_fetch_array($MySQL_Q) or die("שגיאה 4");
}
DBConnect("select * from acats;");
while ($MySQL_Row)
{
echo $MySQL_Row['Acid'];
}
function DBClose()
{
mysql_close($MySQL_Link);
}
?>
Last edited by noam_moshe; 01-02-2009 at 07:02 AM..
|