forum.coppermine-gallery.net

Support => cpg1.5.x Support => cpg1.5 plugins => Topic started by: cmfa on February 11, 2011, 03:55:13 pm

Title: SQL query??
Post by: cmfa on February 11, 2011, 03:55:13 pm
hi@all,

I am dealing with just another port from 1.4x. The plugin rcmenu (http://forum.coppermine-gallery.net/index.php/topic, 33377.html) has it done to me. Unfortunately I run aground at the time of a SQL query. I come here not keep it up right, so maybe someone has a tip why it jams.
The attached error message does not occur continuously. I suspect that my problem here begins with these lines.
Code: [Select]
.
.
.
//check posted value for Menu Item creation
$superCage = Inspekt::makeSuperCage();
$ci = $superCage->get->keyExists('create_item');
$c_i =$superCage->get->keyExists('change_items');
$c_l =$superCage->get->keyExists($p_id);
//addslashes

        if (isset($ci))
{
        $item_title = ($superCage->post->getEscaped('title'));
$item_admin = ($superCage->post->getEscaped('admin_menu'));
$item_hr = ($superCage->post->getEscaped('hr'));
$item_url = ($superCage->post->getEscaped('url'));
$item_target = ($superCage->post->getEscaped('target'));
        $item_id = ($superCage->post->keyExists('id')) +1;
        $sql = "INSERT INTO cpg15x_plugin_rcmenu (id,title,admin,url,target,hrnext) VALUES ('$item_id','$item_title','$item_admin','$item_url','$item_target','$item_hr')";
        cpg_db_query($sql);
}
.
.
.

the rest is running on 1.5xx, Does anyone have a tip for me

CMFA
Title: Re: SQL query??
Post by: Nibbler on February 11, 2011, 05:24:02 pm
Code: [Select]
$item_id = ($superCage->post->keyExists('id')) +1;

That looks like it should be

Code: [Select]
$item_id = ($superCage->post->getInt('id')) +1;
Title: Re: SQL query??
Post by: cmfa on February 11, 2011, 08:09:22 pm
hi

changed it with the same success. If I change here

Code: [Select]
if (($ci) !== TRUE)// no error, no entryor
Code: [Select]
if (isset($ci)) // Error!
then the error message doesn't come but nothing is entered


CMFA
Title: Re: SQL query??
Post by: Αndré on February 11, 2011, 10:16:48 pm
I haven't looked at the plugin code, but it seems that you need to count up the ID plus one. So please use Nibbler's suggestion and try again. Maybe you also have to change all
Code: [Select]
->post->to
Code: [Select]
->get->
Title: Re: SQL query??
Post by: cmfa on February 11, 2011, 11:05:33 pm
Hi,

   
I made the proposed amendment. Unfortunately without the desired success.
Do as above already described query if and do no page refresh the record is saved. F5 is the critical error.

CMFA
Title: Re: SQL query??
Post by: Αndré on February 12, 2011, 10:05:30 am
Do as above already described query if and do no page refresh the record is saved. F5 is the critical error.
Sorry, but I don't know what you try to tell us.
Title: Re: SQL query??
Post by: cmfa on February 12, 2011, 09:18:18 pm
Hi@all

   
Problem found and fixed. Problem lay in the if condition

@ Andre thanks for the friendly kick ;)

VG

CMFA
Title: Re: SQL query??
Post by: Mimer on February 24, 2011, 08:16:56 pm
Is the problem solved in the attached file in the first post?
In other words, will you post the working plugin for cpg 1.5x?

Best regards
Mimer  8)
Title: Re: SQL query??
Post by: cmfa on February 24, 2011, 08:22:59 pm
Hi,

yes the problem is solved. Did the topic is not closed

vg

cmfa
Title: Re: SQL query??
Post by: Αndré on February 24, 2011, 08:58:09 pm
working plugin for cpg 1.5x
http://forum.coppermine-gallery.net/index.php/topic,70509.0.html
Title: Re: SQL query??
Post by: Mimer on February 24, 2011, 09:08:07 pm
Great, tnx. Just what I needed.

Mimer  8)