Reply to Re: Quick and Simple CMS solution/script; does it exist?

Your name:

Reply:


Posted by stiki on 08/26/07 20:53

I can't seem to execute a DDL statement to create a table in my
database.

I'm able to connect to the database, because I tested if connection
was created.

I'm using fnRunSQL($sSQL) (see code below) to run the DDL command and
the function returns false. Does anyone have any idea of what I could
be doing wrong?

$sSQL = "CREATE TABLE upload (
id INT NOT NULL AUTO_INCREMENT,
name VARCHAR(30) NOT NULL,
type VARCHAR(30) NOT NULL,
size INT NOT NULL,
path VARCHAR(60) NOT NULL,
PRIMARY KEY(id)
)";

function fnRunSQL($sSQL) {
//Runs a SQL statement and returns
// - TRUE if successful
// - FALSE if it couldn't connect
// - The MySQL error code if the SQL statement fails
global $sDatabaseName, $sUn, $sPw;

if (!$oConn = @mysql_connect($sDatabaseName, $sUn, $sPw)) {
$bRetVal = FALSE;
} else {
if (!mysql_selectdb($sDatabaseName,$oConn)) {
$bRetVal = FALSE;
} else {
if (!$result = mysql_query($sSQL, $oConn)) {
$bRetVal = mysql_error();
dbg("DATABASE ERROR: ".$bRetVal);
} else {
$bRetVal = TRUE;
mysql_free_result($result);
}
}
mysql_close($oConn);
}
return ($bRetVal);

}

Igor

[Back to original 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

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