473,806 Members | 2,565 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Quick and Simple CMS solution/script; does it exist?

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

Aug 24 '07 #1
7 2839
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.sti kimedia.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=m ysql_fetch_asso c($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
}

Aug 24 '07 #2
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.sti kimedia.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/2...09/webdb2.html
http://www.php-mysql-tutorial.com/php-mysql-upload.php

Enjoy

Aug 24 '07 #3
la******@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.
js*******@attgl obal.net
=============== ===
Aug 24 '07 #4
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_selectd b($sDatabaseNam e,$oConn)) {
$bRetVal = FALSE;
} else {
if (!$result = mysql_query($sS QL, $oConn)) {
$bRetVal = mysql_error();
dbg("DATABASE ERROR: ".$bRetVal) ;
} else {
$bRetVal = TRUE;
mysql_free_resu lt($result);
}
}
mysql_close($oC onn);
}
return ($bRetVal);

}

Igor

Aug 26 '07 #5
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.techre public.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.txt"

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("b vckvs_database. php");
$oDB = new bvckvs_database ();
$sSQL = "CREATE TABLE...";
if($oDB->RunSQL($sSQL ) == false){
echo $oDB->ErrorMessage ;
echo "<pre>" . $oDB->RecordSQL . "</pre>";
} 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.

Aug 26 '07 #6
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_selectd b($sDatabaseNam e,$oConn)) {
$bRetVal = FALSE;
} else {
if (!$result = mysql_query($sS QL, $oConn)) {
$bRetVal = mysql_error();
dbg("DATABASE ERROR: ".$bRetVal) ;
} else {
$bRetVal = TRUE;
mysql_free_resu lt($result);
}
}
mysql_close($oC onn);
}
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($hostNam e, $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_selectd b($dbName,$conn ))
$retval = mysql_error();
else {
if (!$result = mysql_query($sq l, $conn)) {
$retval = mysql_error();
}
}
mysql_close($oC onn);
}
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('hostnam e', '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.
js*******@attgl obal.net
=============== ===
Aug 27 '07 #7
In article <11************ **********@i13g 2000prf.googleg roups.com>,
la******@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
Aug 27 '07 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
9719
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9597
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10620
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10369
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10372
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10110
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7650
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6877
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
3851
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.