Quick and Simple CMS solution/script; does it exist?
Quick and Simple CMS solution/script; does it exist?
am 24.08.2007 08:32:05 von laptopia
I need to build, very quickly, implement a form that will add to a
database two text fields and store store an image associated with this
record.
All my experience with this is from ASP and ASPX, but I'm limited to
an PHP server and MySql. I should rephrase that because I don't thinks
its appropriate to use the word 'limited' when referring to PHP. I'm
starting to like this language.
I've seen tutorials on how to write my own class that will store and
retrieve records from the DB, but I was wondering if there was a
quicker solution.. The content management systems that I'm currently
aware of like Drupal, WP, and many others seem are too complex.
Is there any script/library unknown to me that I can use to quickly
implement this.
By this I mean: Add two records to a database and store an associated
image, then retreave the records for display on a web page.
Regards,
Igor Terzic
Creative Director
www.stikimedia.com
Re: Quick and Simple CMS solution/script; does it exist?
am 24.08.2007 11:43:21 von chandoo
On Aug 24, 11:32 am, lapto...@gmail.com wrote:
> I need to build, very quickly, implement a form that will add to a
> database two text fields and store store an image associated with this
> record.
>
> All my experience with this is from ASP and ASPX, but I'm limited to
> an PHP server and MySql. I should rephrase that because I don't thinks
> its appropriate to use the word 'limited' when referring to PHP. I'm
> starting to like this language.
>
> I've seen tutorials on how to write my own class that will store and
> retrieve records from the DB, but I was wondering if there was a
> quicker solution.. The content management systems that I'm currently
> aware of like Drupal, WP, and many others seem are too complex.
>
> Is there any script/library unknown to me that I can use to quickly
> implement this.
>
> By this I mean: Add two records to a database and store an associated
> image, then retreave the records for display on a web page.
>
> Regards,
> Igor Terzic
> Creative Directorwww.stikimedia.com
Infact i m newbie to php but i wrote a wuery wich will fetch the table
details by refering a id to the script
like $str=select * from the "table" where the email="$id"
and $rs=msql_query($str)
to fetch one row of records
use simplyif($row=mysql_fetch_assoc($rs)
{
the required fields in it...
if u know all this blaw blaw,then sorry for further details u have to
search or wait for it
ok take care
}
Re: Quick and Simple CMS solution/script; does it exist?
am 24.08.2007 13:29:57 von Captain Paralytic
On 24 Aug, 07:32, lapto...@gmail.com wrote:
> I need to build, very quickly, implement a form that will add to a
> database two text fields and store store an image associated with this
> record.
>
> All my experience with this is from ASP and ASPX, but I'm limited to
> an PHP server and MySql. I should rephrase that because I don't thinks
> its appropriate to use the word 'limited' when referring to PHP. I'm
> starting to like this language.
>
> I've seen tutorials on how to write my own class that will store and
> retrieve records from the DB, but I was wondering if there was a
> quicker solution.. The content management systems that I'm currently
> aware of like Drupal, WP, and many others seem are too complex.
>
> Is there any script/library unknown to me that I can use to quickly
> implement this.
>
> By this I mean: Add two records to a database and store an associated
> image, then retreave the records for display on a web page.
>
> Regards,
> Igor Terzic
> Creative Directorwww.stikimedia.com
I tend to use Mambo/Joomla for most of my work, but I agree that it
can be overkill sometimes.
For what you say you wish to do, I think these pages should get you
going well:
http://www.onlamp.com/pub/a/onlamp/2002/05/09/webdb2.html
http://www.php-mysql-tutorial.com/php-mysql-upload.php
Enjoy
Re: Quick and Simple CMS solution/script; does it exist?
am 24.08.2007 13:34:07 von Jerry Stuckle
laptopia@gmail.com wrote:
> I need to build, very quickly, implement a form that will add to a
> database two text fields and store store an image associated with this
> record.
>
> All my experience with this is from ASP and ASPX, but I'm limited to
> an PHP server and MySql. I should rephrase that because I don't thinks
> its appropriate to use the word 'limited' when referring to PHP. I'm
> starting to like this language.
>
> I've seen tutorials on how to write my own class that will store and
> retrieve records from the DB, but I was wondering if there was a
> quicker solution.. The content management systems that I'm currently
> aware of like Drupal, WP, and many others seem are too complex.
>
> Is there any script/library unknown to me that I can use to quickly
> implement this.
>
> By this I mean: Add two records to a database and store an associated
> image, then retreave the records for display on a web page.
>
> Regards,
> Igor Terzic
> Creative Director
> www.stikimedia.com
>
No, but something this is pretty trivial for an experienced programmer.
You probably spent more time looking for such a class/script that it
would take to write.
Understanding, however, that you're new an it will take you longer, but
it's still pretty simple. I'd suggest giving it a try and posting back
here if you run into problems - lots of people will be happy to give you
a hand if you're trying.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Re: Quick and Simple CMS solution/script; does it exist?
am 26.08.2007 22:53:32 von laptopia
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
Re: Quick and Simple CMS solution/script; does it exist?
am 27.08.2007 00:53:00 von Bucky Kaufman
stiki wrote:
> 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?
Wow - you're using code *I* wrote for CNET's Builder.com a half-decade
ago. "http://articles.techrepublic.com.com/5100-22-1045433.html"
That's cool - but it was buggy code then, and it's buggy code now.
For example - it returns a string or boolean - no telling which. And
since a string always equals true, then you can test for a false
condition, but not a true one - bad, bad, bad. *MY* bad, bad, bad.
That article encompassed the whole of my PHP db capabilities at the
time, all wrapped up into 6 buggy functions.
Today, I do all that stuff with a database class... hopefully, much better.
You can download the current version of that code at
"http://www.kaufman.net/bvckvs/redist/bvckvs_database.php.tx t"
It works pretty damned well for me - but I was a buggy little
code-monkey then, and I'm a buggy little code-monkey now. That's my
warranty.
Still - to get what you wanted from that class, rename it to remove the
".txt" and set the variables at the top to your DBMS credentials and
then use this code:
require_once("bvckvs_database.php");
$oDB = new bvckvs_database();
$sSQL = "CREATE TABLE...";
if($oDB->RunSQL($sSQL) == false){
echo $oDB->ErrorMessage;
echo "
" . $oDB->RecordSQL . "
";
} else {
echo "OK";
}
One caveat - RunSQL is probably the only thing you can really use from
that class... unless you take out all the stuff that prefixes table
names with the unique identifier.
Hey, wait. I should refactor that right now. BRB
OK - I did it.
Setting the Unique Table Prefix to "(none)" (the default) keeps the rest
of the class from getting hinky with your table names.
Now, you can use the class's CreateTable and other functions, too.
Another caveat - actually, now I guess this is the only caveat :) - the
CreateTable function automatically creates a PK called "id" that is an
autonumber type. Because anybody who doesn't do that is an idjit and I
wanted to make it idjit-proof.
Re: Quick and Simple CMS solution/script; does it exist?
am 27.08.2007 02:40:56 von Jerry Stuckle
stiki wrote:
> 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
>
Yep, lots of buggy code.
For one thing, you shouldn't use globals. If you need to pass a value
to the function, pass it. If you need to be able to change the original
value, pass it as a reference.
And you're checking the return value for the functions, but if they fail
you have no idea why.
And I don't see where you're actually calling the function fnRunSQL,
much less defined $sDatabaseName, $sUn or $sPw.
As a side note, I don't think Hungarian notation is really good for pHP.
Much better would be:
function RunSQL($hostName, $dbName, $userId, $pwd, $sql) {
//Runs a SQL statement and returns
// - TRUE if successful
// - FALSE if it couldn't connect
// - The MySQL error code if the SQL statement fails
$retval = true;
if (!$conn = mysql_connect($hostName, $uid, $pwd))
$retval mysql_error();
else {
if (!mysql_selectdb($dbName,$conn))
$retval = mysql_error();
else {
if (!$result = mysql_query($sql, $conn)) {
$retval = mysql_error();
}
}
mysql_close($oConn);
}
return ($retval);
}
$SQL = "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)
)";
// Put the actual host name, database name, user id and password in the
// next line
$val = RunSQL('hostname', 'dbname', 'userid', 'password', $sql);
if ($val !=== true) // If the call fails
echo $val;
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Re: Quick and Simple CMS solution/script; does it exist?
am 27.08.2007 11:41:27 von nospam
In article <1188161612.552680.295030@i13g2000prf.googlegroups.com>,
laptopia@gmail.com (stiki) wrote:
> 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.
You haven't said whether you've checked that the login you use has the CREATE
privilege.
--
To reply email rafe, at the address cix co uk