CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> Archive -> GotoCode Archive

 Custom Insert in CCS?

Print topic Send  topic

Author Message
feha
Posted: 08/20/2003, 12:36 AM

I use this in CC:
$db->query("INSERT INTO image_gallery
(title, alttext, src, des, filename, filesize, filetype, img_width, img_height)
VALUES
(\"$alttext\", \"$alttext\", \"$data\", \"$strDescription\", \"$src_name\", \"$src_size\", \"$src_type\", \"$img_width\", \"$img_height\")
");


but in CCS like:

global $DBddd;
$imageSQL ="INSERT INTO image_gallery
(title, alttext, src, des, filename, filesize, filetype, img_width, img_height)
VALUES
(".$alttext.",".$alttext.",".$data.",".$strDescription.",".$src_name.",".$src_size.",".$src_type.",".$img_width.",".$img_height.")
";
$DBddd->query($imageSQL);

It doesn't work!

I get:Fatal error: Call to a member function on a non-object in c:\inetpub\wwwroot\php\DDD\Admin\AddImage.php on line 44
line 44 is: $DBddd->query($imageSQL);


RonB
Posted: 08/21/2003, 6:10 AM

Try instantiating a new db object and transform the varaibles to text:

$db=new clsDBddd();
$imageSQL ="INSERT INTO image_gallery
(title, alttext, src, des, filename, filesize, filetype, img_width, img_height)
VALUES
("'.$alttext."','".$alttext."','".$data."','".$strDescription."','".$src_name."','".$src_size."','".$src_type."','".$img_width."','".$img_height."'")
";
$db->query($imageSQL);
unset($db);

RonB
glerma
Posted: 08/21/2003, 10:39 AM

You have to instantiate your database connection class first.

Example:
$DBddd = new clsDB<DBConnectionName>; (Replace DBConnectionName with your own)
$imageSQL ="INSERT INTO image_gallery
(title, alttext, src, des, filename, filesize, filetype, img_width, img_height)
VALUES
(".$alttext.",".$alttext.",".$data.",".$strDescription.",".$src_name.",".$src_size.",".$src_type.",".$img_width.",".$img_height.")
";
//Release Resources and close connection.
$DBddd->query($imageSQL);
$DBddd->close();
unset($DBddd);
feha
Posted: 08/21/2003, 12:35 PM

Thank You for Your answer, I will try your proposals.

regards
feha
[www.vision.to]
feha
Posted: 08/21/2003, 4:18 PM

It works, thank you

I used to before show row and it worked without "instantiate your database connection class" ...

So i had problems when I wanted to use it before show page ...
it is very important to use "instantiate your database connection class" in before show page ...

Thanks :-)
feha
regards
[www.vision.to]



   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.