Stefce 146 Posting Pro

Yup nothing at all even if the password doesnt match and yes thats the correct script

Stefce 146 Posting Pro

Nothing happens when i press the button, just closing the modal box
Yea it works when i echo into the SQL and yeah conn is a valid object and works in other classes

Stefce 146 Posting Pro

Hello everyone, first of all i like to say that the new daniweb webdesign is AMAZING i really like it and hope this site it will become number one for programming and if it does please never BAN its users like stackowerflow do but thats other theme.. :D
I have a problem with the change password box this code should work but it doesn't any solutions ?

<!-- CHANGE PASSWORD BOX -->
    <form method="POST" action="navigation.php">
        <div class="modal fade" id="changePassword">
            <div class="modal-dialog modal-md">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal">&times;</button>
                        <h4 class="modal-title">Change Account Password</h4>
                    </div>
                    <div class="modal-body">
                        <p><input type="text" class="form-control" name="oldPass" placeholder="Enter Old Password"/></p>
                        <p><input type="text" class="form-control" name="newPass" placeholder="Enter New Password"/></p>
                    </div>
                    <div class="modal-footer">
                        <input type="submit" class="btn btn-success btn-block" data-dismiss="modal" name="changePass">Change Password</input>
                    </div>
                </div>
            </div>
        </div>
        <?php
        if(isset($_POST['changePass'])) {
            $newPass = $_POST['newPass'];
            $oldPass = $_POST['oldPass'];

            $password = getUserData('users', 'Password');

            if($oldPass != $password) {
        ?>
            <p>Incorrect 'Old Password'</p>
        <?php
            } else if($newPass == $password) {
        ?>
            <p>You must use different password!</p>
        <?php
            } else {
                $user = getUserData('users', 'UserUsername');
                $email = getUserData('users', 'Email');
                $sql = "UPDATE `users` SET `Password`='".$newPass."' WHERE `Email`='".$email."' AND `UserUsername`='".$user."'";
                $return = $conn->query($sql);
        ?>
            <p>Password changed successfully.</p>
        <?php
            }
        }
        ?>
    </form>
Stefce 146 Posting Pro

Just and example

public Account(String username) throws FileNotFoundException, IOException {
        this.username = username;

        File folder = new File("C:\\"+username);
        File file = new File(folder, username + ".txt");

        FileReader freader = new FileReader(file);
        try (BufferedReader breader = new BufferedReader(freader)) {
            String line;
            String[] parts;
            String key, value;
            while ((line = breader.readLine()) != null) {
                parts = line.split("=");
                key = parts[0].trim();
                value = parts[1].trim();
                switch (key) {
                    case "Name":
                        name = value;
                        break;
                    case "Password":
                        password = value;
                        break;
                    case "Security Code":
                        securityCode = value;
                        break;
                    case "Card ID":
                        cardID = value;
                        break;
                    case "Admin":
                        admin = Integer.parseInt(value);
                        break;
                    case "Bank Rob":
                        bankrob = Integer.parseInt(value);
                        break;
                    case "Credit":
                        credit = Integer.parseInt(value);
                        break;
                }
            }
        }
    }

Name = Stefan
Age = 20
etc..

JamesCherrill commented: Does not answer the OP's question +0
Stefce 146 Posting Pro

Im using this on my game quiz.. hope it will help you too:

String[] questions = {
    "What year is launched Facebook ?", // 0
    "What year is born Michael Jackson ?",// 1
    "Which are the owner's of Google ?"
};
String[] answers = {
    "2004", // 0
    "1958", // 1
    "larry page and sergey brin"
};

int questionNumber;

final void setQuestion(int nr) {
    questionNumber = nr;
    question.setText(questions[questionNumber]);
}

void chooseNewQuestion() {
    Random rand = new Random();
    int nr;
    do {
        nr = rand.nextInt(questions.length);
    } while (nr == questionNumber);
        setQuestion(nr);
    }

/*void changeQueston() {
This is for timer if you want to change the question if is not answered in certain time But you have to build the timer by your self...

    question.setText(questions[questionNumber]);
    if (TimerTime >= 3) {
        setQuestion(WIDTH);
    }
}*/

and put theese into public qsez1()

public qsez1() {
    initComponents();
    //changeQueston(); 
    getContentPane().setBackground(new Color(255,51,51));
    setQuestion(0);
    setResizable(false);
}
JamesCherrill commented: Completely fails to address the OP's question -3
Stefce 146 Posting Pro

What part of code you need to see ? The other dialog boxes or ?

Stefce 146 Posting Pro

UPDATE IF SOMEONE IS SEEING THIS:

I have created one more class called LocalService.java i extend it with Service and implemented theese methods onBind(), onStartCommand() and onDestroy(), on my MainActivity i have created the whole application which gets the coordinates of the user and updates automaticly so it will know when to start the task. The most important stuff is in onCreate() method, which is mMap.setOnMapClickListener ("mMap" is from private GoogleMap mMap;) also under this are mMap.setOnMyLocationChangeListener and mMap.setOnMarkerClickListener... BUT the task i want to start is mMap.setOnMyLocationChangeListener please someone help me how i can do this in the LocalService.java to run in the background...
Thank you

Stefce 146 Posting Pro

Hello guys i have problem with my app, its all done but just need one more thing.. to run in background so it can start the alarm and send notification to the user... i saw much tutorials on internet but damn it i can't understand it is there some good men/woman to help me ?

Stefce 146 Posting Pro

Anyone ?

Stefce 146 Posting Pro

Hello everyone i have a problem with my application onMarkerClick it works well till i click the marker second time the application crashes here is the code:

mMap.setOnMarkerClickListener(new GoogleMap.OnMarkerClickListener() {
                    @Override
                    public boolean onMarkerClick(Marker marker) {


                        builder.setTitle("Set radius in meters:");
                        builder.setMessage("Info: The radius is set by default on 500 meters");

                        // Specify the type of input expected; this, for example, sets the input as a password, and will mask the text
                        input.setInputType(InputType.TYPE_CLASS_NUMBER);
                        builder.setView(input);

                        // Set up the buttons
                        builder.setPositiveButton("Set", new DialogInterface.OnClickListener() {
                            @Override
                            public void onClick(DialogInterface dialog, int which) {
                                m_Text = Integer.parseInt(input.getText().toString());
                                Toast.makeText(getBaseContext(), "Radius set to: " + m_Text + " meters;", Toast.LENGTH_LONG).show();
                                circle.setRadius(m_Text);
                            }
                        });
                        builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
                            @Override
                            public void onClick(DialogInterface dialog, int which) {
                                dialog.cancel();
                            }
                        });

                        builder.show();
                        return false;
                    }
                });

The error is The specified child already has a parent. You must call removeView() on the child's parent first.
and the line is where return false is.

Stefce 146 Posting Pro

I tried the intent and it works good but theres one problem every time i click the button it starts new activity and saves it but doesn't close it/finish... also i would like to ask how i can use the third method i tried it but dont know how to use it and does it run in background after the application is closed ?

Stefce 146 Posting Pro

Thanks man i think i need the third one because the app needs to update on every user location change and also show notification. I will come with more info tommorow when ill test the code. Hope it will do well.
Also i have question abouth the third one, it is possible after the finished task to start a new session ?

Stefce 146 Posting Pro

Woow that was really big embarrassing :D but still i dont get it.. i have changed again with return value into apply but now application crashes if you are avuncular to show me in example how can be done it would be awesome for me and my eyes :P

Stefce 146 Posting Pro

Error:'void' type not allowed here

EDIT: the default radius i want to set is on 500 metters, is there any way that to be changed after circle is created ?

Stefce 146 Posting Pro

Hmm i dont get it i have tryed the following code but i have another problem here... i cannot use sa.apply() in the .radius() method

This is SettingsActivity.java

public int metters;

public void setRadius(int radiusss) {
    metters = radiusss;
}

public int getRadius() {
    return metters;
}

public void apply() {
    setAlarm.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            int getM = Integer.parseInt(getMetters.getText().toString());
            if (getM > 3000) {
                errors.setText("ERROR");
            } else {
                errors.setText("ACCEPTED");
            }
        }
    });
}

Here is the MainActivity.java

SettingsActivity sa = new SettingsActivity();
        int metters;
        sa.setRadius(metters);
        // Creating circle around marker
        circle = mMap.addCircle(new CircleOptions()
            .center(latLng)
            .radius(sa.apply()) // Not alowed like this
            .strokeColor(Color.RED)
            .fillColor(Color.GREEN)
        );
Stefce 146 Posting Pro

Hello guys i have a really dumb problem i have two classes the first class is where the input value needs to be applied/readed and the second is where is inputed i do not know how to do that please someone help me

This is where it is inputed the value

final EditText getMetters = (EditText) findViewById(R.id.getMettersText);
final TextView errors = (TextView) findViewById(R.id.errorMessage);
Button setAlarm = (Button) findViewById(R.id.setAlarmButton);

setAlarm.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
        int getM = Integer.parseInt(getMetters.getText().toString());
        if (getM > 3000) {
            errors.setText("ERROR");
        } else {
            errors.setText("ACCEPTED");
        }
    }
});

And here where needs to be writen

circle = mMap.addCircle(new CircleOptions()
    .center(latLng)
    .radius(1000) // here needs to apply the value
    .strokeColor(Color.RED)
    .fillColor(Color.GREEN)
);
Stefce 146 Posting Pro

I want to create circle around marker but im having some troubles i have this code

Circle circle = mMap.addCircle(new CircleOptions()
    .center(new LatLng(-33.87365, 151.20689))
    .radius(10000)
    .strokeColor(Color.RED)
    .fillColor(Color.BLUE));

this code is drawing circle around Sydney but i want to create where i place the marker here is the code together with the marker creation:

 mMap.setOnMapClickListener(new GoogleMap.OnMapClickListener() {

            @Override
            public void onMapClick(LatLng latLng) {

                // Creating a marker
                MarkerOptions markerOptions = new MarkerOptions();

                // Setting the position for the marker
                markerOptions.position(latLng);

                // Setting the title for the marker.
                // This will be displayed on taping the marker
                markerOptions.title(latLng.latitude + " : " + latLng.longitude);
                String title = markerOptions.getTitle();
                // Clears the previously touched position
                mMap.clear();

                // Animating to the touched position
                mMap.animateCamera(CameraUpdateFactory.newLatLng(latLng));

                // Placing a marker on the touched position
                mMap.addMarker(markerOptions);
                //Create circle around the marker
                Circle circle = mMap.addCircle(new CircleOptions()
                        .center(new LatLng(-33.87365, 151.20689))
                        .radius(10000)
                        .strokeColor(Color.RED)
                        .fillColor(Color.BLUE));
            }
        });
Stefce 146 Posting Pro

I have a problem with installing Android Studio i followed thenewboston youtube channel for installing it and when i try to run it shows me some errors: C:\Users\MONSTER\AppData\Local\Android\sdk\tools\emulator.exe -avd Nexus -netspeed full -netdelay none emulator: ERROR: This AVD's configuration is missing a kernel file!! emulator: ERROR: ANDROID_SDK_ROOT is undefined i deleted first and redownloaded again the JDK and Android Studio but again the same error please if someone know how to install properly to enter in my PC via TeamViewer and help me.
Thank you.

Stefce 146 Posting Pro

BTW this code it stores the name in database but the picture is in folder uploads into the website file directory, i cant understand how can that picture be shown in the website available for all users... also when other user will upload picture where it will go that picture if he doesn't have folder called uploads ?

Stefce 146 Posting Pro

So this should be like this ?

if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) {
    echo "The file ". basename( $_FILES["fileToUpload"]["name"]). " has been uploaded.";
    $sql = "INSERT INTO `pictures` VALUES ('', '".$_FILES["fileToUpload"]["name"]."')";
    $result = $conn->query($sql);
} else {
    echo "Sorry, there was an error uploading your file.";
}
Stefce 146 Posting Pro

I forgot to upload the code...

<?php
$target_dir = "uploads/";
$target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]);
$uploadOk = 1;
$imageFileType = pathinfo($target_file,PATHINFO_EXTENSION);
// Check if image file is a actual image or fake image
if(isset($_POST["submit"])) {
    $check = getimagesize($_FILES["fileToUpload"]["tmp_name"]);
    if($check !== false) {
        echo "File is an image - " . $check["mime"] . ".";
        $uploadOk = 1;
    } else {
        echo "File is not an image.";
        $uploadOk = 0;
    }
}
// Check if file already exists
if (file_exists($target_file)) {
    echo "Sorry, file already exists.";
    $uploadOk = 0;
}
// Check file size
if ($_FILES["fileToUpload"]["size"] > 500000) {
    echo "Sorry, your file is too large.";
    $uploadOk = 0;
}
// Allow certain file formats
if($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg"
    && $imageFileType != "gif" && $imageFileType != "mp4" && $imageFileType != "wmv" 
    && $imageFileType != "mp3") {
    echo "Sorry, only JPG, JPEG, PNG & GIF files are allowed.";
    $uploadOk = 0;
}
// Check if $uploadOk is set to 0 by an error
if ($uploadOk == 0) {
    echo "Sorry, your file was not uploaded.";
// if everything is ok, try to upload file
} else {
    if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) {
        echo "The file ". basename( $_FILES["fileToUpload"]["name"]). " has been uploaded.";
    } else {
        echo "Sorry, there was an error uploading your file.";
    }
}
?>
Stefce 146 Posting Pro

Hello i want to make upload button so users can upload images/gifs/videos/music but i cannot understand how i can do that i fuond a code on w3schools but it just uploads the image to folder in my computer called /uploads i want to store the images into database which they will be available/shown in the website... please someone help me

Stefce 146 Posting Pro

Here it is from w3schools..

upload.php

<?php
$target_dir = "uploads/";
$target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]);
$uploadOk = 1;
$imageFileType = pathinfo($target_file,PATHINFO_EXTENSION);
// Check if image file is a actual image or fake image
if(isset($_POST["submit"])) {
    $check = getimagesize($_FILES["fileToUpload"]["tmp_name"]);
    if($check !== false) {
        echo "File is an image - " . $check["mime"] . ".";
        $uploadOk = 1;
    } else {
        echo "File is not an image.";
        $uploadOk = 0;
    }
}
// Check if file already exists
if (file_exists($target_file)) {
    echo "Sorry, file already exists.";
    $uploadOk = 0;
}
// Check file size
if ($_FILES["fileToUpload"]["size"] > 500000) {
    echo "Sorry, your file is too large.";
    $uploadOk = 0;
}
// Allow certain file formats
if($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg"
&& $imageFileType != "gif" ) {
    echo "Sorry, only JPG, JPEG, PNG & GIF files are allowed.";
    $uploadOk = 0;
}
// Check if $uploadOk is set to 0 by an error
if ($uploadOk == 0) {
    echo "Sorry, your file was not uploaded.";
// if everything is ok, try to upload file
} else {
    if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) {
        echo "The file ". basename( $_FILES["fileToUpload"]["name"]). " has been uploaded.";
    } else {
        echo "Sorry, there was an error uploading your file.";
    }
}
?>
Stefce 146 Posting Pro

Please if anyone could help me with this problem ?

Stefce 146 Posting Pro

anyone ?

Stefce 146 Posting Pro

Hello i have three colums which i want to make users can upload pictures/videos and automaticly to add to one of the colums but i cannot figure out how to do that... here is the HTML code i have

<div class="main">
    <div class="row">
        <div class="col-md-3">
            <div class="panel panel-default">
                <div class="panel-body">
                    Picture/Video
                </div>
            </div>
        </div>
        <div class="col-md-3">
            <div class="panel panel-default">
                <div class="panel-body">
                    Picture/Video
                </div>
            </div>
        </div>
        <div class="col-md-3">
            <div class="panel panel-default">
                <div class="panel-body">
                    Picture/Video
                </div>
            </div>
        </div>
    </div>
</div>

and also the fourth column to be fixed at the right side

Stefce 146 Posting Pro

Okay thanks, i think i've got it.. i need to define panel id which will be the ticketID and from there i need JavaScript to hide the panel if that's the solution i have one question. Am i alowed to use PHP in div id for ex. <div class="panel panel-default" id="<?php $ticket_id ?>"> and than to use it in JavaScript like this

$(document).ready(function() {
    $('#hide').on('click', function(e) { 
        $('$ticket_id').remove();
    });
});

i tryed this but no working... if you can help me about this it would be great thank you very much :)

Stefce 146 Posting Pro

Actually i have two modals in this file, first is on the top of the body and have nothing to do with the loop and the second is in the loop but as you said remove from the loop so i put it on the bottom after the loop ending, so now its showing the last added ticetID :D

Stefce 146 Posting Pro

But the same code works on another file here it is...

<form action='home.php' method='POST'>
<table>
    <tr>
        <td>
            <table id='t01'>
                <thead>
                    <tr>
                        <th colspan='2'>
                            <button name="share" class="share_button" value="<?= $ticket_id ?>" type="submit" id="shareBtn" title="Share ticket" onclick="change()">Share</button>
                            <button name="closeTicket" class="close_tic_btn" type="submit" value="<?= $ticket_id ?>" id="shareBtn" title="Remove ticket" onclick="change()">X</button>
                        </th>
                    </tr>
                    <tr>
                        <th colspan='2'>
                            Ticket <?= $count ?>
                            <a style='position: relative; float: right;'>Ticket ID: <?= $ticket_id ?></a>
                        </th>
                    </tr>
                </thead>
                <tbody>
                <tr>
                    <td><?= $row["match1"] ?></td>
                    <td><?= $row["tip1"] ?></td>
                </tr>
                <tr>
                    <td><?= $row["match2"] ?></td>
                    <td><?= $row["tip2"] ?></td>
                </tr>
                <tr>
                    <td><?= $row["match3"] ?></td>
                    <td><?= $row["tip3"] ?></td>
                </tr>
                <tr>
                    <td><?= $row["match4"] ?></td>
                    <td><?= $row["tip4"] ?></td>
                </tr>
                <tr>
                    <td><?= $row["match5"] ?></td>
                    <td><?= $row["tip5"] ?></td>
                </tr>
                <tr>
                    <td><?= $row["match6"] ?></td>
                    <td><?= $row["tip6"] ?></td>
                </tr>
                <tr>
                    <td><?= $row["match7"] ?></td>
                    <td><?= $row["tip7"] ?></td>
                </tr>
                <tr>
                    <td><?= $row["match8"] ?></td>
                    <td><?= $row["tip8"] ?></td>
                </tr>
                <tr>
                    <td><?= $row["match9"] ?></td>
                    <td><?= $row["tip9"] ?></td>
                </tr>
                <tr>
                    <td><?= $row["match10"] ?></td>
                    <td><?= $row["tip10"] ?></td>
                </tr>
                <tr>
                    <td><?= $row["match11"] ?></td>
                    <td><?= $row["tip11"] ?></td>
                </tr>
                <tr>
                    <td><?= $row["match12"] ?></td>
                    <td><?= $row["tip12"] ?></td>
                </tr>
                <tr>
                    <td><?= $row["match13"] ?></td>
                    <td><?= $row["tip13"] ?></td>
                </tr>
                <tr>
                    <td><?= $row["match14"] ?></td>
                    <td><?= $row["tip14"] ?></td>
                </tr>
                <tr>
                    <td><?= $row["match15"] ?></td>
                    <td><?= $row["tip15"] ?></td>
                </tr>
                <tr>
                    <td><?= $row["match16"] ?></td>
                    <td><?= $row["tip16"] ?></td>
                </tr>
                <tr>
                    <th colspan='2'>Total Bet: <?= $uplata_total ?></th>
                </tr>
                <tr>
                    <th colspan='2'>Total Win: <?= $dobivka_total ?></th>
                </tr>
            </tbody>
        </table>
    </td>
</tr>
</table>
</form>
Stefce 146 Posting Pro

Oops.. that was a misstake i have deleted that it was there from before because the lines are copied btw i will pot the full script and yes it is in loop but i have the same script just without bootstrap and it works fine..

<?php 
        $responseText = '';
        $user = getUserData('users', 'UserUsername');
        if(isset($_POST['closeTicket'])) {
            $ticket_id = (int) $_POST['closeTicket'];
            $sql = "UPDATE `kladilnica` SET `isActive` = 0 WHERE `ticket_id` = '$ticket_id' AND `Username`='$user'";
            $return = $conn->query($sql);
            $responseText = ($conn->affected_rows)
            ? "<li class='SuccShared' id='activator'>Something went wrong</li>" 
            : "<li class='ticketRemoved' id='activator'>Ticket ($ticket_id) was removed successfully</li>";
        }
        if(isset($_POST['share'])) {
            $ticket_id = (int) $_POST['share'];
            $sql = "UPDATE `kladilnica` SET `isShared`=1 WHERE `ticket_id` = '$ticket_id' AND `Username`='$user'";
            $return = $conn->query($sql);
            $responseText = ($conn->affected_rows) 
            ? "<li class='SuccShared' id='activator'>You have successfully shared the ticket $ticket_id</li>" 
            : "<li class='AlreadyShared' id='activator'>The ticket ($ticket_id) was shared already</li>";

        }
        $sql = "SELECT `Uplata`, `Dobivka`, 
        `match1`, `match2`, `match3`, `match4`, 
        `match5`, `match6`, `match7`, `match8`, 
        `match9`, `match10`, `match11`, `match12`, 
        `match13`, `match14`, `match15`, `match16`, 
        `tip1`, `tip2`, `tip3`, `tip4`, 
        `tip5`, `tip6`, `tip7`, `tip8`, 
        `tip9`, `tip10`, `tip11`, `tip12`, 
        `tip13`, `tip14`, `tip15`, `tip16`, 
        `ticket_id`, `isActive`, `isShared` 
        FROM `kladilnica` 
        WHERE `Username`='$user'";

        $result = $conn->query($sql);
        $count = 0;
        $uplata_total = 0;

        if($result === false) {
            echo "<b>Could not connect to database.</b>";
            trigger_error('Wrong SQL: ' . $sql . ' Error: ' . $conn->error, E_USER_ERROR);
        } else {
            if($result->num_rows == 0) {
                echo "<b>You do not have any tickets.</b>";
        } else if($result->num_rows >= 1) {
            $count = $count + 1;
            while($row = $result->fetch_assoc()) {
                if($result->num_rows != empty($row['match1'])) {
                    $uplata_total = $row["Uplata"];
                    $dobivka_total …
Stefce 146 Posting Pro

I have a problem with this code and i really can't understand what is it.. i have unique ID for every ticket and it works good but i have made a button to open a modal (#myModal) and from there to send the ticket to some username but the problem is no matter what ticket i choose to send just the first ticket code is shown also when i try to remove any ticket i can't, its just possible to remove the first ticket.

<tr style="background-color: lavender;">
    <th>
        <button type="submit" class="btn btn-primary btn-xs" name="share" value="<?= $ticket_id ?>" id="shareBtn" title="Share ticket" onclick="change()">Share</button>
        <button type="button" class="btn btn-danger btn-xs" data-toggle="modal" value="<?= $ticket_id ?>" data-target="#myModal" onclick="change()">Ticket ID: <?= $ticket_id ?></button>

        <div class="modal fade" id="myModal" role="dialog">
            <div class="modal-dialog modal-sm">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal">&times;</button>
                        <h4 class="modal-title">Send Ticket (<?= $ticket_id ?>)</h4>
                    </div>
                    <div class="modal-body">
                        <p><input type="text" class="form-control" id="username" placeholder="Enter Username"/></p>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-success btn-block" data-dismiss="modal">Send</button>
                    </div>

                </div>
            </div>
        </div>
    </th>
    <th>
        <a type="submit" class="close" data-dismiss="panel" aria-label="close" id="hide" value="<?= $ticket_id ?>" title="Remove ticket" name="closeTicket" onclick="change()">&times;</a>
    </th>
</tr>
Stefce 146 Posting Pro

Thank you very much the code works :)

Stefce 146 Posting Pro

With this code dissapears just the first row where the close button is

Stefce 146 Posting Pro

Hello everyone i started learning bootstrap for a while and i want to make close button for div boxes i have this code but the X button doesn't work:

<div class="panel panel-default">
    <table class="table table-hover">
        <thead>
            <tr style="background-color: lavender;">
                <th><button type="button" class="btn btn-primary btn-xs">Share</button></th>
                <th><a href="#" class="close" data-dismiss="panel" aria-label="close" id="hide">&times;</a></th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td>Manchester United - Manchester United</td>
                <td>2 - 1</td>
            </tr>
            <tr>
                <td>FC Barcelona - Manchester</td>
                <td>T1 2+p.p</td>
            </tr>
            <tr>
                <td>Manchester United - Manchester United</td>
                <td>2 - 1</td>
            </tr>
            <tr>
                <td>FC Barcelona - Manchester United</td>
                <td>2 - 1</td>
            </tr>
            <tr style="background-color: lightgreen;">
                <th>Bet: 2100</th>
                <th>Win: 55864</th>
            </tr>
        </tbody>
    </table>
</div>

and here is the JavaScript:

$(document).ready(function() {
    $("#hide").click(function(){
        $("panel").hide();
    });
});

thank you :)

Stefce 146 Posting Pro

read the full question and code...

Stefce 146 Posting Pro

i cannot select from two tables but i have the right code here it is:

$sql = "INSERT INTO ticket (senderName, receiverName, `Date`, ticketID, match1, match2, match3, match4, match5, match6, match7, match8, match9, match10, match11, match12, match13, match14, match15, match16, tip1, tip2, tip3, tip4, tip5, tip6, tip7, tip8, tip9, tip10, tip11, tip12, tip13, tip14, tip15, tip16, Bet, Gain, Odd) 
SELECT Username, '".$ticketReceiver."', `Date`, ticket_id, match1, match2, match3, match4, match5, match6, match7, match8, match9, match10, match11, match12, match13, match14, match15, match16, tip1, tip2, tip3, tip4, tip5, tip6, tip7, tip8, tip9, tip10, tip11, tip12, tip13, tip14, tip15, tip16, Uplata, Dobivka, Odds FROM kladilnica, users WHERE kladilnica.ticket_id='".$ticketID."' AND users.Username='".$ticketReceiver."'";

it gives me this error
Fatal error: Wrong SQL: INSERT INTO ticket (senderName, receiverName,Date, ticketID, match1, match2, match3, match4, match5, match6, match7, match8, match9, match10, match11, match12, match13, match14, match15, match16, tip1, tip2, tip3, tip4, tip5, tip6, tip7, tip8, tip9, tip10, tip11, tip12, tip13, tip14, tip15, tip16, Bet, Gain, Odd) SELECT Username, 'VladoRafa',Date, ticket_id, match1, match2, match3, match4, match5, match6, match7, match8, match9, match10, match11, match12, match13, match14, match15, match16, tip1, tip2, tip3, tip4, tip5, tip6, tip7, tip8, tip9, tip10, tip11, tip12, tip13, tip14, tip15, tip16, Uplata, Dobivka, Odds FROM kladilnica, users WHERE kladilnica.ticket_id='550415' AND users.Username='VladoRafa' Error: Column 'Username' in field list is ambiguous in C:\xampp\htdocs\asdf\navigation.php on line 217
and the line 217 is this one

$result = $conn->query($sql);
if($result === false) {
    trigger_error('Wrong SQL: ' . $sql . ' Error: ' . $conn->error, E_USER_ERROR); // <--- this one 
} else {... …
Stefce 146 Posting Pro

I realized that i need to select from two tables first the (ticket_id) from kladilnica and secound the (Username) from users to check if exists, so i searched and found this

$sql = "INSERT INTO ticket (senderName, receiverName, Date, ticketID, match1, match2, match3, match4, match5, match6, match7, match8, match9, match10, match11, match12, match13, match14, match15, match16, tip1, tip2, tip3, tip4, tip5, tip6, tip7, tip8, tip9, tip10, tip11, tip12, tip13, tip14, tip15, tip16, Bet, Gain, Odd) 
                                    SELECT Username, '".$ticketReceiver."', Date, ticket_id, match1, match2, match3, match4, match5, match6, match7, match8, match9, match10, match11, match12, match13, match14, match15, match16, tip1, tip2, tip3, tip4, tip5, tip6, tip7, tip8, tip9, tip10, tip11, tip12, tip13, tip14, tip15, tip16, Uplata, Dobivka, Odds FROM kladilnica, users WHERE kladilnica.ticket_id='".$ticketID."' AND users.Username='".$ticketReceiver."'";

**but it gives me error **
Fatal error: Wrong SQL: INSERT INTO ticket (senderName, receiverName, Date, ticketID, match1, match2, match3, match4, match5, match6, match7, match8, match9, match10, match11, match12, match13, match14, match15, match16, tip1, tip2, tip3, tip4, tip5, tip6, tip7, tip8, tip9, tip10, tip11, tip12, tip13, tip14, tip15, tip16, Bet, Gain, Odd) SELECT Username, 'VladoRafa', Date, ticket_id, match1, match2, match3, match4, match5, match6, match7, match8, match9, match10, match11, match12, match13, match14, match15, match16, tip1, tip2, tip3, tip4, tip5, tip6, tip7, tip8, tip9, tip10, tip11, tip12, tip13, tip14, tip15, tip16, Uplata, Dobivka, Odds WHERE kladilnica.ticket_id='550415' AND users.Username='VladoRafa' Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE kladilnica.ticket_id='550415' AND users.Username='VladoRafa'' at …

Stefce 146 Posting Pro

Here is again the whole query:

<?php
    if(isset($_POST['sendTicket'])) {
        $ticketID = $_POST['ticketID'];
        $ticketReceiver = $_POST['ticketReceiver'];

        $ticket_id = getUserData('kladilnica', 'ticket_id');
        $sender = getUserData('users', 'Username');

        if(!empty($ticketID) && !empty($ticketReceiver)) {
            $sql = "INSERT INTO ticket (senderName, receiverName, Date, ticketID, match1, match2, match3, match4, match5, match6, match7, match8, match9, match10, match11, match12, match13, match14, match15, match16, tip1, tip2, tip3, tip4, tip5, tip6, tip7, tip8, tip9, tip10, tip11, tip12, tip13, tip14, tip15, tip16, Bet, Gain, Odd) 

            SELECT Username, '".$ticketReceiver."', Date, ticket_id, match1, match2, match3, match4, match5, match6, match7, match8, match9, match10, match11, match12, match13, match14, match15, match16, tip1, tip2, tip3, tip4, tip5, tip6, tip7, tip8, tip9, tip10, tip11, tip12, tip13, tip14, tip15, tip16, Uplata, Dobivka, Odds FROM kladilnica WHERE ticket_id='".$ticketID."' AND Username='".$ticketReceiver."'";
            $result = $conn->query($sql);

            if($result === false) {
                trigger_error('Wrong SQL: ' . $sql . ' Error: ' . $conn->error, E_USER_ERROR);
            } else {
                if($ticketReceiver == $sender) {
                ?>
                    <p>You cannnot send to yourself!</p>
                <?php
                } else {
                    if($conn->affected_rows > 0) {
                    ?>
                        <p>Sended successfully</p>
                    <?php
                    } else {
                    ?>
                        <p>Invalid Ticket or Receiver</p>
                    <?php
                    }
                }
            }
        } else {
        ?>
            <p>Can't leave empty</p>
        <?php
        }
    }
?>
Stefce 146 Posting Pro

Nope

Stefce 146 Posting Pro

I tried that but again it gives me the error Invalid Ticket or Receiver

Stefce 146 Posting Pro

so any other options about this problem ?

Stefce 146 Posting Pro

I have do it like that because of the post if have `` theese it will be outsite the box something like this ANDUsername='VladoRafa' Error: You have an error in your SQL syntax;

Stefce 146 Posting Pro

here is the full error message
Fatal error: Wrong SQL: INSERT INTO ticket (senderName, receiverName, Date, ticketID, match1, match2, match3, match4, match5, match6, match7, match8, match9, match10, match11, match12, match13, match14, match15, match16, tip1, tip2, tip3, tip4, tip5, tip6, tip7, tip8, tip9, tip10, tip11, tip12, tip13, tip14, tip15, tip16, Bet, Gain, Odd) VALUES SELECT Username, VladoRafa, Date, ticket_id, match1, match2, match3, match4, match5, match6, match7, match8, match9, match10, match11, match12, match13, match14, match15, match16, tip1, tip2, tip3, tip4, tip5, tip6, tip7, tip8, tip9, tip10, tip11, tip12, tip13, tip14, tip15, tip16, Uplata, Dobivka, Odds FROM kladilnica WHERE ticket_id='550415' AND 'Username'='VladoRafa' Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT Username, VladoRafa, Date, ticket_id, match1, match2, match3, match4, mat' at line 2 in C:\xampp\htdocs\asdf\navigation.php on line 208

Stefce 146 Posting Pro

Im trying without them just like VladoRafa without anything

Stefce 146 Posting Pro

nope it gives me error Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT Username, 'VladoRafa', Date, ticket_id, match1, match2, match3, match4, m' at line 2 in

Stefce 146 Posting Pro

Some one help me PLEASE ?

Stefce 146 Posting Pro

yes it returs

Stefce 146 Posting Pro

I have this code for checking the username and ticket availability but something doesnt work well if someone can tell me whats the problem, this error shows me if i enter the right info Invalid Ticket or Receiver here is the code:

<?php
                                    if(isset($_POST['sendTicket'])) {
                                        $ticketID = $_POST['ticketID'];
                                        $ticketReceiver = $_POST['ticketReceiver'];

                                        $ticket_id = getUserData('kladilnica', 'ticket_id');
                                        $sender = getUserData('users', 'Username');

                                        if(!empty($ticketID) && !empty($ticketReceiver)) {
                                            $sql = "INSERT INTO ticket (senderName, receiverName, Date, ticketID, match1, match2, match3, match4, match5, match6, match7, match8, match9, match10, match11, match12, match13, match14, match15, match16, tip1, tip2, tip3, tip4, tip5, tip6, tip7, tip8, tip9, tip10, tip11, tip12, tip13, tip14, tip15, tip16, Bet, Gain, Odd) 
                                            SELECT Username, '".$ticketReceiver."', Date, ticket_id, match1, match2, match3, match4, match5, match6, match7, match8, match9, match10, match11, match12, match13, match14, match15, match16, tip1, tip2, tip3, tip4, tip5, tip6, tip7, tip8, tip9, tip10, tip11, tip12, tip13, tip14, tip15, tip16, Uplata, Dobivka, Odds FROM kladilnica WHERE ticket_id='".$ticketID."' AND `Username`='".$ticketReceiver."'";
                                            $result = $conn->query($sql);

                                            if($result === false) {
                                                trigger_error('Wrong SQL: ' . $sql . ' Error: ' . $conn->error, E_USER_ERROR);
                                            } else {
                                                if($ticketReceiver == $sender) {
                                                ?>
                                                    <p>You cannnot send to yourself!</p>
                                                <?php
                                                } else {
                                                    if($conn->affected_rows > 0) {
                                                    ?>
                                                        <p>Sended successfully</p>
                                                    <?php
                                                    } else {
                                                    ?>
                                                        <p>Invalid Ticket or Receiver</p>
                                                    <?php
                                                    }
                                                }
                                            }
                                        } else {
                                        ?>
                                            <p>Can't leave empty</p>
                                        <?php
                                        }
                                    }
                                ?>
Stefce 146 Posting Pro

but than it gives me error Invalid Ticket or Receiver even if i type right input

Stefce 146 Posting Pro

I dont quite get it what should i do to remove the line ? :/
Sorry about this long time no PHP ...
BTW yes im using MySQLi