Szabi Zsoldos 26 Learner and helper guy

Really ?

Szabi Zsoldos 26 Learner and helper guy

I can see the errors, but this looks like it is for your homework.
Please be polite, and dont just paste the question.

Szabi Zsoldos 26 Learner and helper guy

oh, my bad :)
Try this.

$result='SELECT username FROM members WHERE username = "'.$myusername.'" AND id = 1 LIMIT 1';

As IIM said, it would be wiser to use the PDO class rather than mysql but for starters you cand use this on the username mysql_real_escape_string($myusername)

Szabi Zsoldos 26 Learner and helper guy

SoapUI is a very good software, i've used it alot for testing purposes!

Szabi Zsoldos 26 Learner and helper guy

What @iamthwee is telling you to do is that you have to create 1+ tables that will link with the student ID to your students table.

Please reffer to this link JOINS

Szabi Zsoldos 26 Learner and helper guy

Please change your connection as this

$con = mysql_connect($host, $username, $password) or die(mysql_error());

And then tell us what error it gives to you.

But the problem is at your query.

This is your query.

$result="SELECT username FROM members WHERE username = ". $myusername. " AND id = ". 1 ." limit 1";

Change it to this, the problem is it with your username, you have to pass it like a string.

$result='SELECT username FROM members WHERE username = "'.$myusername.'" AND id = '.1.' LIMIT 1';
Szabi Zsoldos 26 Learner and helper guy

Did you error dissapear ?

Szabi Zsoldos 26 Learner and helper guy

you could try highcharts, it is very easy to set it up.

Szabi Zsoldos 26 Learner and helper guy

Exchange has an authorization module in the settings, and you can allow your IP to send emails trough it without authentification.
The simplest methods is the SMTP with the Exchange domain name if its in the lan or the Exchange IP.

Szabi Zsoldos 26 Learner and helper guy

put on your first line ob_start(); and on the last line ob_flush();

<?php

ob_start();

/**
*
*   Your code goes here
*
**/

ob_flush();

?>
Szabi Zsoldos 26 Learner and helper guy

The simplest way is that you have to drop the database and recreate it :)

Szabi Zsoldos 26 Learner and helper guy

Diafol, thank you for your input, this is exactly what i want to do. It will be a small service for photographers like me to verify their dates for clients.
Let me chew your post so i can start working on it! :)

Szabi Zsoldos 26 Learner and helper guy

Hi guys,

I don't even know where to start, the ideea is that I want to develope an API that responds with certain data, but I don't have a clue for what to look.

The ideea is that there is a panel like google analytics but with no stats, but some info for some users and I want to let them embed this into their pages as a service.
I think that Javascript or iframe, but I really dislike iframes.

Could you please point me for this method so that I know what to look for ? :)
Thanks.

Szabi Zsoldos 26 Learner and helper guy

Typically, I just execute the code manually that the cron job I am going to create will run.

This is exactly what I also doin these cases.

Szabi Zsoldos 26 Learner and helper guy

Okay, the problem is on your 240 line on your WHILE, you attempt to use the same $row variable outside the WHILE which is not a correct way.

So your $query1 does not know what is $row['message_id'];

Szabi Zsoldos 26 Learner and helper guy

Post where do you call mysql_fetch_assoc();

Szabi Zsoldos 26 Learner and helper guy

Please post your 369 line from lol.php

Szabi Zsoldos 26 Learner and helper guy

I've tried different methods to login, succeded with DOM but not with CURL for this particular page.

function Login($data = "") {
    $ch = curl_init();

    curl_setopt($ch, CURLOPT_URL,"https://portal.onrc.ro/ONRCPortalWeb/appmanager/myONRC/public?_nfpb=true&_pageLabel=login");
    curl_setopt($ch, CURLOPT_HEADER, FALSE);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS,http_build_query(array(
        "j_username"  => $data['j_username'],
        "j_password"  => $data['j_password']
    )));
    curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);


    $server_output = curl_exec ($ch);


    return $server_output;        
} 

I dont know if it's not based on some ajax calls that are encrypted....

Szabi Zsoldos 26 Learner and helper guy

The problem is way harder than this, I'm familiarized with CURL but this one is giving me a hard time :(
I am successfully logging in but when it comes to extract certain data, it is not working.

Szabi Zsoldos 26 Learner and helper guy

You can post to a page with cUrl.

pritaeas, thank you but how do I set the post methods for example to this link ?

The input field name is wmcCif:cif

https://portal.onrc.ro/ONRCPortalWeb/appmanager/myONRC/wicket/?wicket:interface=:9:1:::

There are the POST parameters viewed with Firebug.

Parametersapplication/x-www-form-urlencoded
cautare x
criteriu    filtru.cif
wmcCif:cif  1757980
Source
cautare=x&criteriu=filtru.cif&wmcCif%3Acif=1757980

And this is the form from the page

<form id="idTestWicket03__1__2" method="post" action="https://portal.onrc.ro:443/ONRCPortalWeb/appmanager/myONRC/wicket?_nfpb=true&_windowLabel=TestWicket03_1&_urlType=action&wlpTestWicket03_1__wu=%2FONRCPortalWeb%2Fappmanager%2FmyONRC%2Fwicket%2F%3Fwicket%3Ainterface%3D%3A4%3AformCautare%3A1%3AIFormSubmitListener%3A%3A"><div style="width:0px;height:0px;position:absolute;left:-100px;top:-100px;overflow:hidden"><input type="hidden" name="idTestWicket03__1__2_hf_0" id="idTestWicket03__1__2_hf_0" /></div>
                            <table cellpadding="5">
                                <tr>
                                    <td width="150">
                                        Cautare dupa: 
                                    </td>
                                    <td>
                                        <select class="select_357" onchange="document.getElementById('idTestWicket03__1__2_hf_0').value='/ONRCPortalWeb/appmanager/myONRC/wicket/?wicket:interface=:4:formCautare:criteriu:1:IOnChangeListener::';document.getElementById('idTestWicket03__1__2').submit();" name="criteriu">
                                        <option value="filtru.buletin">Nr. de buletin</option>
                                        <option value="filtru.persoana">Persoana publicata în BPI</option>
                                        <option selected="selected" value="filtru.cif">CIF</option>
                                        <option value="filtru.reg">Nr. de ordine în Registru</option>
                                        <option value="filtru.dosar">Nr. dosar</option>
                                        <option value="filtru.interval">Interval de publicare</option>
                                        </select>
                                    </td>
                                </tr>
                            </table>
                            <div>
                                <table cellpadding="5">
                                    <tr>
                                        <td width="150">
                                            CIF: 
                                        </td>
                                        <td>
                                            <input class="input_142" type="text" value="1757980" name="wmcCif:cif"/>
                                        </td>
                                    </tr>
                                </table>                        
                            </div>
                            <div>
                            <button class="submit" type="submit" onclick="var e=document.getElementById('idTestWicket03__1__2_hf_0'); e.name='cautare'; e.value='x';var f=document.getElementById('idTestWicket03__1__2');var ff=f;if (ff.onsubmit != undefined) { if (ff.onsubmit()==false) return false; }f.submit();e.value='';e.name='';return false;"><span>Cauta</span></button>
                            </div>
                        </form>
Szabi Zsoldos 26 Learner and helper guy

Hi guys,

I want to create a crawler to extract some infomation from a page.
The problem is that it is written with the Java Wicket Framework and I don't know how to scrape informations from it because I don't know how to submit some post parameters.

Is this possible to do ? :)
Thank you.

Szabi Zsoldos 26 Learner and helper guy

You could use the Google Business Apps for this solution.

Szabi Zsoldos 26 Learner and helper guy

This is a function that I've used a while back in a Class.
You have to generate your language files like en.txt or de.txt.

In your PHP code you will call the function and the string $contet->__('translate me');
In your de.txt you will have on each line a separate text.

translate me=übersetzen mich

You will have to set your language based on your user settings.

        $language = $this->selectLanguage();
        $this->language = $language;

Then call the following function with $content->__('translate me'); and you should have your text translated.

    public function findString($str) {
        if (array_key_exists($str, $this->lang[$this->language])) {
            return $this->lang[$this->language][$str];
        }
        return $str;
    }


    /**
    * after the text is found your explode it by =
    * @param string $str
    * @returneaza Returns the exploded string 
    */
    public function splitStrings($str) {
        return explode('=',trim($str));
    }


    /** 
    * Function that translates the text  
    * it the words/translation are found, if not, default language will be the written native language
    * @param string $str
    * @returneaza returns a translaton trough splitString();
    */
    public function __($str) {    
        if (!array_key_exists($this->language, $this->lang)) {
            if (file_exists($this->language.'.txt')) {
                $strings = array_map(array($this,'splitStrings'),file($this->language.'.txt'));
                foreach ($strings as $k => $v) {
                    $this->lang[$this->language][$v[0]] = $v[1];
                }
                return $this->findString($str);
            }
            else {
                return $str;
            }
        }
        else {
            return $this->findString($str);
        }
    }
Szabi Zsoldos 26 Learner and helper guy

This is my aproach on a needed way, check this out.

            $('.' + obj + ' .deliv_date').datepicker({
                dateFormat: "yy-mm-dd", 
                showButtonPanel: true,
                beforeShow: function(input, inst) {
                    var calendar = inst.dpDiv;
                    setTimeout(function() {
                        calendar.position({
                            my: 'right top',
                            at: 'right bottom',
                            collision: 'none',
                            of: input
                        });
                    }, 1);
                },
                changeYear: true,
                changeMonth: true,
                minDate: 0,
                beforeShowDay: $.datepicker.noWeekends,
                numberOfMonths: 1
            });
Szabi Zsoldos 26 Learner and helper guy

is your website a CMS or a custom developed website ?

Szabi Zsoldos 26 Learner and helper guy

the $result variable should be an array, post the $result data please so we can see the problem.

Szabi Zsoldos 26 Learner and helper guy

Check your privileges on the user for MySQL, there is a privilege you have to set.
If it is root, then there is no drop problem.

Szabi Zsoldos 26 Learner and helper guy

query is not a function/method in this Class, you have to write a query function in your Database class with the PDO query function so that it will work.

Szabi Zsoldos 26 Learner and helper guy

The best thing is that you find yourself an idea of what you want to achieve and build your learning around that.
For php is best to start at the basics PHP.net will do it for starters, but for different logics, as diafol said, you need some good books, and if possible, offer yourself as an intern and steal some logic, that's how I started it :)

Szabi Zsoldos 26 Learner and helper guy

I've checked. But there is nothing about XAMPP

That is normal because your Apache or MySQL server have a problema, there is something corrupt with one of them, maybe a failed extension or setting.

Szabi Zsoldos 26 Learner and helper guy

Please close this Article if you solved your problem.

Szabi Zsoldos 26 Learner and helper guy

The errors you are looking for can be found in the Error Reporting, Right click on My Computer -> Manage -> Event viewer -> Windows Logs -> Application

Szabi Zsoldos 26 Learner and helper guy

Please post the table scheme, maybe it's a problem of the ID and you are trying to import the data in the wrong column.

You can try the HeidiSQL which gives you feedback upon each error.

Szabi Zsoldos 26 Learner and helper guy

What do you mean by

really different

Show us your code-snipet to see the exact problem.

Szabi Zsoldos 26 Learner and helper guy

Please specify where did you imported the CSV.

NOTE: If you have imported in MySQL, check your datatypes, if it's INT it will chunk it, you should use float, double or decimal in this case.

Szabi Zsoldos 26 Learner and helper guy

As it seems you are using a wrong user to connect, as the string says

hjhwkhjrf user ?

correct the login data, otherwise your commands are allright.

Szabi Zsoldos 26 Learner and helper guy

You can try it in XML also, but be aware that your are disaplaying your API key :)

Szabi Zsoldos 26 Learner and helper guy

In that case you should treat your files as files, not necesarily images, I imagine that you want to build stock library.

It is personal or public ?
If is personal than do it in Adobe Lightroom, if it's public shure, you can do it by PHP.

Szabi Zsoldos 26 Learner and helper guy

Thank you, I've managed to solve the problem with a callback function in my ajaxpage();

It is a custom made platform.

Szabi Zsoldos 26 Learner and helper guy

this can reffer to two things, one is from jQuery, it's the element that you want to affect. The other one is that i can be from a class and you can reffer as this to another function from the same clasee.

In your case it is the first one that reffers to the element that is in your scope.
this is a DOM element and id is the ID of the element.

Szabi Zsoldos 26 Learner and helper guy

Hi guys,

I'm working on a shopping cart and I'm having some difficulties with a concept.

Basicly, I remove two articles in a certain condition and it works perfectly.
My problem is that I want to redirect the user instantly if these two articles are removed from the cart.
When I enter the window.location, it is refreshing the page but it's not updating the cart from the ajax call.

So what I want to achieve is that after these two ajax calls, i want to be redirected but also, the ajax call should do their things in the delete_item.php :)

I'm using jQuery inside a normal javascript file on a certain function.

    function deleted(id, pozitie) {
        var msg = 0;
        $(document).ready(function(){                    
            $('.' + id).each(function() { 
                $(this).remove();
                $('.sm').remove();
                ajaxpage("delete_item.php?id="+pozitie+"&ord="+ordrno,"error");
                ajaxpage("delete_item.php?id="+(pozitie+1)+"&ord="+ordrno,"error");
                window.location="http://mypage.com/offer";
                msg = 1;
            });
        });
Szabi Zsoldos 26 Learner and helper guy

Please post us your code so we can see, also be sure to set your head tags in the HTML.

Szabi Zsoldos 26 Learner and helper guy

You need the php 5.3 verion for the DateTime::createFromFormat, it was introduced in that version.

Szabi Zsoldos 26 Learner and helper guy

Please give more details about your problem, and tell us what do you want to achieve...

Szabi Zsoldos 26 Learner and helper guy

You have to assign the checkbox also an array to the name target[] and then you will have to parse over $_GET['target'] with different methods.

You can use $elements = count($_GET['target']);

if($elements > 0) {
    for($i = 0; $i <= $elements; $i++) {
        echo $_GET['target'][$i].'-'.$_GET['os'][$i];
    }
}

In this way you are iterating over the arrays and you can do whatever you want with them.

Szabi Zsoldos 26 Learner and helper guy

If I'm not mistaking the problem is with your AND t.channel_id = '1' please try removing that and see the results.

Szabi Zsoldos 26 Learner and helper guy

Please try the UNION function for this.

If you want more fields, the selected fields have to be equal as a number in all your union selects.

Please note that this can be done in multiple ways, this is not the only option.

(SELECT your_fields FROM yourTable1 WHERE yourField LIKE '%yourSearch%' LIMIT yourLimit) 
UNION (SELECT your_fields FROM yourTable2 WHERE yourField LIKE '%yourSearch%' LIMIT yourLimit)
UNION (SELECT your_fields FROM yourTable3 WHERE yourField LIKE '%yourSearch%' LIMIT yourLimit)
Szabi Zsoldos 26 Learner and helper guy

Well the best is your own because you can make it based on your needs.
It depends on your needs.

Szabi Zsoldos 26 Learner and helper guy

Please paste a preview with some data from the table.

Szabi Zsoldos 26 Learner and helper guy

What are your WHERE fields and values for the two tables ?