[UPHPU] Calling MySQL Functions within a class or function
Gill Bates
unixgeek at zoelife4u.org
Sat May 6 09:04:57 MDT 2006
OK i give up, I've never had any luck writing a function that contains
call to mysql funtions with PHP. I am revamping my site and there are to
be multiple calls to a MySQL database and I don't want to have to write
the calls everytime.. The solution is to write a function with the calls
and just call the new function. But it never inserts any data. I
recently came across a nice class at:
http://www.tonymarston.net/php-mysql/databaseobjects.html and thought it
would work nice, but it's still not inserting anything into the
database, and it throwing errors at me, now admittedly I'm not a
programmer, I'm doing this more as a hobby but this is a thorny problem
that I would like to have resolved ASAP. I will attach the class file
and paste the offending function call. Any help will be appreciated,
thanks. I entered the code nearly as is from the above site, really
changing only $query to $SQL, beings as I recognize that as my query
strings faster :). Anyways, here ya go.
db.php is attached.
Offending Code:
switch ($section){
case "home":
$dbobject = new dbTable;
if (!$action){
chooseAction($section);
} else {
switch ($action) {
case "add":
//Add Function Here
if (!isset($_POST['submit'])) {
showForm($section, $action);
} else {
$fieldarray =
$dbobject->insertRecord($fieldarray); //<<---- This is where the
script stops
}
break;
case "edit":
//Edit Fuction Here
break;
case "delete":
//Delete Function here
break;
}
}
...... Rest of the switch statement, which remains incomplete...
Here's the error it produces:
*
Fatal Error: MySQL error: : (# 256).
Error in line 144 of file
'/usr/home/jnbek/public_html/zoelife4u.org/newstuff/db.php'.
Script:
*
More information about the UPHPU
mailing list