PDA

View Full Version : Help with plugin


chicote
06-21-2008, 02:50 PM
I create 2 fields in a table ABC, the first field is the X and Y is the second, both store data in a form checkbox, 0 if not checked, and 1 case marked.

Now my question is, I want to create a plugin, which store data from the field X and Y of the field on 2 variables for later I make a comparison in postbit and show a message if X = 1, and another case X = 0, the same applies to Y, show some message if Y = 1 and another message if Y = 0;

For this reason I created a plugin with the following code:

Hook Location: Postbit_display_complete

Plugin PHP Code:
$test = $db->query_read("SELECT * FROM". TABLE_PREFIX. "ABC");
$test = $db->num_rows($test);

$test_x = $test['x'];
$test_y = $test['y']; Then put the template postbit the following condition:
<if condition="$test_x =='1'"> Testing X </if>
<if condition="$test_y =='1'"> Testing Y </if> But nothing worked, someone could help me?

Dismounted
06-21-2008, 02:52 PM
You aren't writing in PHP - I suggest you read some material on PHP. :)

chicote
06-21-2008, 03:05 PM
It could indicate a tutorial, where I can help me, to correct this plugin?

Thank

Opserty
06-21-2008, 03:19 PM
You need to learn the PHP basics, use google and search for "PHP Basics" or "PHP Introduction".

Else try the php.net site. http://www.php.net/manual/en/getting-started.php (You can also view it in different languages)

Dismounted
06-22-2008, 06:44 AM
Also, you might want to look up how databases work, or explain your situation more clearly, as I understand it now, all you have is a single row in your table.