AndrisP 193 Posting Pro in Training

Perhaps more convenient to use the selector instead of a text field

<select name="bodovi">
    <script type="text/javascript">
    for(var i=1; i<=50; i++){
        document.write('<option value="'+i+'">'+i+'</option>');
        }
    </script>
</select>
AndrisP 193 Posting Pro in Training

Use elseif instead if in lines 5 and 6 of my code

AndrisP 193 Posting Pro in Training
$errors = array();

// and then test for all errors
if(!ctype_digit($var)){ $errors[] = "NOT DIGIT!"; }
if($var==0){ $errors[] = "IS SET NULL!"; }
if($var==""){ $errors[] = "IS SET EMPTY VALUE!"; }
//........

if(empty($errors)){
    // statement for good user selection
    }
else {
    foreach($errors as $line){
        echo $line."<br/>";
        }
    }
AndrisP 193 Posting Pro in Training

Maybe something like this:

$('#anchor, #anchor2, #anchor3')
    .click(function(){ ... })
    .dblclick(function(){ ... })
    .hover(function(){ ... });
AndrisP 193 Posting Pro in Training
if(!ctype_digit($var)){ echo "NOT DIGIT"; }
AndrisP 193 Posting Pro in Training

Cut and paste line 6 after the line 23

AndrisP 193 Posting Pro in Training

Line 25 replace elseif to if, lines 13, 16, 19, 22 need quotes like this:
if ($place == 'balkon')

AndrisP 193 Posting Pro in Training

I recommend to insert spaces:

<?php if($True == 0){ ?>
    <a href="/#"> Apply </a>
<?php } else { ?>
    <a href="/#"> Aleary applied </a> 
<?php } ?>
ravi142 commented: @AndrisP : Thank You. +1
AndrisP 193 Posting Pro in Training

Ok as You Like

AndrisP 193 Posting Pro in Training

Me it works perfectly. Maybe try another delimiter e.g. ||

AndrisP 193 Posting Pro in Training
DROP TRIGGER IF EXISTS after_insert_event;
DELIMITER $$
CREATE TRIGGER after_insert_event AFTER INSERT ON event
    FOR EACH ROW
    BEGIN
    INSERT INTO guest (event_id, event_name) VALUES (NEW.event_id, NEW.event_name);
    END; $$

And check your syntax also in this:

$event = mysql_query("INSERT INTO event VALUES('','$name','$dstart $tstart','$dend $tend','$venue','')") or die(mysql_error());

Where is column names?

AndrisP 193 Posting Pro in Training

trigger you write once and it is stored in the database

AndrisP 193 Posting Pro in Training

Something like this:

CREATE TRIGGER after_insert_event AFTER INSERT ON event 
FOR EACH ROW 
    BEGIN
        INSERT INTO guest (event_id, event_name) VALUES (NEW.event_id, NEW.event_name)
    END;

but your first example not correct "INSERT INTO event ????? VALUES"

AndrisP 193 Posting Pro in Training

Put after line 17:

if(!$requestCompParse){
    $e = oci_error($conn);
    echo "Parse error: ".$e['message'];
    }

replace line 19 to:

$ex = oci_execute($requestCompParse);

and put after line 19:

if(!$ex){
        $e = oci_error($requestCompParse);
        echo "Execute error: ".$e['message'];
        }
AndrisP 193 Posting Pro in Training

Would not it be more convenient to use a trigger?

AndrisP 193 Posting Pro in Training

And by the way ID and NAME tokens must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"), colons (":"), and periods (".").
http://www.w3.org/TR/html4/types.html

AndrisP 193 Posting Pro in Training
<?php
$array = array( array(0.8, 1.2, 2.4, 3.2, 4), array(2, 4, 6, 8, 10) );
echo "<form action=\"".$_SERVER['PHP_SELF']."\" method=\"post\">";
for($a=1; $a<=5; $a++){
    $arr = ($a>1?$array[1]:$array[0]);
    foreach($arr as $key => $val){
    $checked = ((isset($_POST['radiobutton_'.$a])&&$_POST['radiobutton_'.$a]==$val)?" checked=\"checked\"":"");
    echo "
    <input type=\"radio\" id=\"ch_".$a."_".$key."\"".$checked." name=\"radiobutton_".$a."\" value=\"".$val."\" />
        <label for=\"ch_".$a."_".$key."\">".($key+1)."</label>";
        }
    echo "<br/>";
    }
echo "<input type=\"submit\" name=\"submit\" value=\"submit\" /></form>";

if(isset($_POST['submit'])){
    $total = 0;
    for($a=1; $a<=5; $a++){
        if(isset($_POST['radiobutton_'.$a])){
            $cur = $_POST['radiobutton_'.$a];
            echo $a."-sum = ".$cur."<br/>";
            $total += $cur;
            }
        }
    echo "Total: ".$total;
    }
?>
AndrisP 193 Posting Pro in Training

Use checkbox instead of radio
Something like this:

<?php
$array = array( array(0.8, 1.2, 2.4, 3.2, 4), array(2, 4, 6, 8, 10) );
echo "<form action=\"".$_SERVER['PHP_SELF']."\" method=\"post\">";
for($a=1; $a<=5; $a++){
    $arr = ($a>1?$array[1]:$array[0]);
    foreach($arr as $key => $val){
        echo "
        <input type=\"checkbox\" id=\"ch_".$a."_".$key."\" name=\"ch_".$a."[]\" value=\"".$val."\" />
        <label for=\"ch_".$a."_".$key."\">".$val."</label>";
        }
    echo "<br/>";
    }
echo "<input type=\"submit\" name=\"submit\" value=\"submit\" /></form>";

if(isset($_POST['submit'])){
$total = 0;
for($a=1; $a<=5; $a++){
    if(isset($_POST['ch_'.$a])){
        $cur = array_sum($_POST['ch_'.$a]);
        echo $a."-sum = ".$cur."<br/>";
        $total += $cur;
        }
    }
echo "Total: ".$total;
}
?>
AndrisP 193 Posting Pro in Training
<?php
$id = 3; // e.g. value of checked
for($i=1; $i<=5; $i++){
$checked = ($id==$i?" checked=\"checked\"":""); ?>
    <input type="radio" class="css-checkbox" id="1radio<?=($id);?>"<?=$checked;?> name="<?=($id);?>" value="<?=$i;?>">
    <label for="1radio<?=($id);?>" class="css-label"><?=$i;?></label>
<?php } ?>

What is the value of your "$count" sequential or not?

AndrisP 193 Posting Pro in Training

var a = str.replace(/error/,'my replace')
or
str.replace(/anything.*anything/,'anything my replace anything')
if I understand correctly

AndrisP 193 Posting Pro in Training

Cut line 2: $place = mysql_real_escape_string($_POST['place']);
and write after check isset() (line 4): if(isset($_POST['place']))

AndrisP 193 Posting Pro in Training

swap()
is C++ built-in function

catastrophe2 commented: o its supposed be SWAP, but it still runs either way, just that i need to fix the problem i mentioned in my first post +1
AndrisP 193 Posting Pro in Training

Link to css file put in XSLT file, like:

<?php

header("Content-type:text/xml;charset=utf-8");
print "<?xml version=\"1.0\" encoding=\"utf-8\"?>
<?xml-stylesheet type=\"text/xsl\" href=\"transform.xsl\" ?>";

echo '<markers>';
    while ($row = @mysql_fetch_assoc($result)){
    echo '<marker ';
    echo 'name ="' . parseToXML($row['name']) . '" ';
    echo 'address ="' . parseToXML($row['address']) . '" ';
    echo 'lat ="' . $row['lat'] . '" ';
    echo 'lng ="' . $row['lng'] . '" ';
    echo '/>';
    }
echo '</markers>';

?>

File "transform.xsl" e.g.

<?xml version="1.0" encoding="utf-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/">
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
            <link rel="stylesheet" type="text/css" href="/style.css" />
            <title>My Page TITLE</title>
        </head>
        <body>
            <xsl:apply-templates />
        </body>
    </html>
</xsl:template>

<xsl:template match="/markers">
    <xsl:for-each select="marker">
        ................
        ................
        ................
    </xsl:for-each>
</xsl:template>
AndrisP 193 Posting Pro in Training

&amp;

AndrisP 193 Posting Pro in Training

Write PHP header and XML header in line 65
header("Content-type:text/html;charset=utf-8");
print "<?xml version=\"1.0\" encoding=\"utf-8\"?>";

AndrisP 193 Posting Pro in Training

Yes, iamthwee. Congratulations!

AndrisP 193 Posting Pro in Training
#include <iostream>
using namespace std;

bool IsPrime(int number)
{
    for (int i=2; i<=number/2; i++)
    {
        if (number % i == 0) return false;
    }
    return true;
}


int main()
{
    for(int i=2; i<=100; i++)
    {
    cout << i << (IsPrime(i)?" is prime":"") << "\n";
    }
system ("PAUSE");
return 0;
}
iamthwee commented: -1 -3
AndrisP 193 Posting Pro in Training

It should be ok if SID is auto_increment or is default value for SID, but ERROR if not

AndrisP 193 Posting Pro in Training

C++ bult-in function

#include <iostream>

using namespace std;

int main()
{
    int a,b;
    cin >> a;
    cin >> b;
    cout<< "Numbers are " << a <<" "<< b <<endl;
    swap(a,b);
    cout << "Swaped numbers are " << a <<" "<< b << endl;
}
AndrisP 193 Posting Pro in Training

Arranged brace in line 107

AndrisP 193 Posting Pro in Training

e.g.

<?php 
// put php script - functions classes, methods etc

header("Content-type:text/html;charset=utf-8");
print "<?xml version=\"1.0\" encoding=\"utf-8\"?>
"; ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="lt">

<head>
.....
</head>
<body>
<?php
// again php script in HTML body
?>
<p>print some HTML content</p>
<?php
// and again php script in HTML body
?>
</body>
</html>
AndrisP 193 Posting Pro in Training
AndrisP 193 Posting Pro in Training

Yes of course. See my comment above.

AndrisP 193 Posting Pro in Training

Yes of course. See my comment above

AndrisP 193 Posting Pro in Training

exact match

$sql = "SELECT * FROM mytablename WHERE `fullnames` = '$searchname'";

or search by name parts

$sql = "SELECT * FROM mytablename WHERE `fullnames` LIKE '%$searchname%'";
AndrisP 193 Posting Pro in Training

HTML - Hyper Text Markup Language, it is not script! Impossible to check text file without php.

AndrisP 193 Posting Pro in Training

Put function to beginning of this file,

    <?php
    function parsefile($filename){
    $file = @file($filename);
    while(list($key,$val)=each($file)){
    $line = explode(";",$val);
    if($line[1]==$_SERVER['REMOTE_ADDR']) return true;
    }
    return false;
    }
    header("Content-type:text/html;charset=utf-8");
    ?>

edit lines 90-100

<div class="block last"><h2>Konkursas<br> dėl Vip,Admin</h2>
<?php if (parsefile("konkursas.txt")){ echo "Error message"; }
else { ?>
<form action='konkursas.php' method='post'>
<p>El. pašto adresas</p><input type='text' title="Čia turėtų būti jūsų email." name ='nail' size= '30'/>
<br />
<br />
<input type='submit' name='submit' value='OK'/>
<br />
</form>
<?php } ?>

and save this file as php

AndrisP 193 Posting Pro in Training

check IP address

if (parsefile("konkursas.txt")){ echo "Error message"; }
else { echo "<form> ..... </form>"; }
AndrisP 193 Posting Pro in Training

You can use trigger in database. If you have not previously used read this: http://dev.mysql.com/doc/refman/5.6/en/trigger-syntax.html

AndrisP 193 Posting Pro in Training

use td:last-child in css

AndrisP 193 Posting Pro in Training

if you save in file as

<?php

fwrite($file,$email.";".$_SERVER['REMOTE_ADDR'].";".PHP_EOL);

?>

you can use this function

<?php

function parsefile($filename){
    $file = @file($filename);
    while(list($key,$val)=each($file)){
        $line = explode(";",$val);
        if($line[1]==$_SERVER['REMOTE_ADDR']) return true;
        }
    return false;
    }

?>
AndrisP 193 Posting Pro in Training

for example:

RewriteEngine on

RewriteCond %{REMOTE_ADDR} ^127.0.0.1$
RewriteRule !(^ban_page.html) /ban_page.html [R]
AndrisP 193 Posting Pro in Training

Not need input field "ip" in form - user can change it.

    <?php
    if (isset($_POST['submit'])) {
    $file = fopen('konkursas.txt','a+');
    $email = $_POST['nail'];
    fwrite($file,$email." [".$_SERVER['REMOTE_ADDR']."]".PHP_EOL);
    fclose($file);
    print_r(error_get_last());
    header("Location: http://www.mypage.com") ;
    }
    ?>
sigitas.darguzas commented: Thanks :) +0
AndrisP 193 Posting Pro in Training

No input tag types "ip" and "email". Please check http://www.w3schools.com/tags/tag_input.asp

sigitas.darguzas commented: okey but dont work. i need autopatic fill ip in konkursas.txt +0
AndrisP 193 Posting Pro in Training

In your example, there is no difference "++" pattern before or after the "number1", but if you change your code to:

#include <iostream>

int main()
    {
    int number1 = 0;
    int number2 = 0;
    while(number1 < 5)
        {
        number2 += number1++;
        }
    std::cout << "number1 = " << number1 << std::endl;
    std::cout << "number2 = " << number2 << std::endl;
    }

than will first be counted (number2 + number1) and than number1 will be increased by 1, but if you change number2 += ++number1; than first number1 will be increased by 1 and after counted (number2 + number1)

AndrisP 193 Posting Pro in Training

Any case like this:

case 1:
        cout <<"-- Area Menu --"<<'\n';
        cout <<"1. Retangle"<<'\n';
        cout <<"2. Circle"<<'\n';
        cout <<"3. Right Triangle"<<'\n';
        cout <<"Enter Menu Number Choice: ";
        cin >> areamenuitem;
        break;

need write in one line like:

case 1: cout <<"-- Area Menu --\n1. Retangle\n2. Circle\n3. Right Triangle\nEnter Menu Number Choice: "; cin >> areamenuitem; break;

or write in brace:

case 1: {
        cout <<"-- Area Menu --"<<'\n';
        cout <<"1. Retangle"<<'\n';
        cout <<"2. Circle"<<'\n';
        cout <<"3. Right Triangle"<<'\n';
        cout <<"Enter Menu Number Choice: ";
        cin >> areamenuitem;
        break;
        }
AndrisP 193 Posting Pro in Training
ryan.jay.ong commented: we are only allowed to use stdio and conio sir +0
AndrisP 193 Posting Pro in Training

Pointers need to delete at the end

#include <iostream>

using namespace std;

    struct Vagon{

       int num;
       Vagon *next;
       Vagon(int vNum){ num=vNum; next=NULL; };
       ~Vagon(){};

    };

    class Voz{
        private:
            Vagon *first;
            Vagon *last;
        public:
            void addVagon(int num){
                Vagon *konduktor=new Vagon(num);
                if(first==NULL){ first=konduktor; }
                else { last->next=konduktor; }
                last=konduktor;
                }
            void printList(void){
                Vagon *konduktor=first;
                while(konduktor!=NULL){
                    cout << konduktor->num << ",";
                    konduktor=konduktor->next;
                    }
                }
            void clearList(void){
                Vagon *konduktor=first;
                while(konduktor!=NULL){
                    first=first->next;
                    delete konduktor;
                    konduktor=first;
                    }
                }
            Voz(){
                first=last=NULL;
                };
            ~Voz(){
                clearList();
                delete first,last;
                };
    };

int main()
{
    Voz *vagonList=new Voz();

    for(int i=13; i<16; i++){
        vagonList->addVagon(i);
        }

    vagonList->printList();

    delete vagonList;
    return 0;
}
AndrisP 193 Posting Pro in Training

Maybe this useful
SELECT LPAD(CAST(myValue AS DECIMAL(4,2)), 5, '0');
The result will be:
11.5, 5.5, 2.25, 1, 12.25
AS
11.50 05.50 02.25 01.00 12.25

AndrisP 193 Posting Pro in Training
    const int SIZE = 4;
    int counter = 0;
    while(counter<SIZE) {

        // do something ...

        if(SIZE == counter+1) { cout << "Hello world"; }

        counter++;
        }