table_fun using mysql query

Discuss MySQL Ajax Table Editor

table_fun using mysql query

Postby usrb » Tue Feb 03, 2015 12:08 pm

Hello,

I'm using data only from one table.
I have a need to format the field as in function formatLink example in documentation.
The difference is I need to format http link using output from mysql query from another table.

Here is what I did:
Code: Select all
        function link_ap($col,$val,$row)
        {
                if($row['ap_hostname'] != '')
                {
                        include '/var/www/html/baza/reports/login.php';
                        $result_ip = mysql_query("select ip_address from core_wireless where ap_hostname='".$row['ap_hostname']."'");
                        return '<a href="https://'$result_ip'" target=_blank title="Otvori">'$result_ip'</a>';
                }
                else
                {
                        return $val;
                }
        }


I get an error "[Tue Feb 03 12:46:26 2015] [error] [client 10.19.0.120] PHP Parse error: syntax error, unexpected T_VARIABLE in /var/www/html/baza/korisnici.php on line 120, referer: https://10.19.2.2/baza/index.php" in httpd error log.
Line 120 is this one:
Code: Select all
return '<a href="https://'$result_ip'" target=_blank title="Otvori">'$result_ip'</a>';


Please help,
thank you
usrb
 
Posts: 12
Joined: Mon Nov 07, 2011 6:00 pm

Re: table_fun using mysql query

Postby zwerfkat » Mon Feb 09, 2015 11:14 am

you forgot the dots to concat $result_ip. It should be:

return '<a href="https://'.$result_ip.'" target=_blank title="Otvori">'.$result_ip.'</a>';
zwerfkat
 
Posts: 3
Joined: Tue Jan 27, 2015 11:26 am

Re: table_fun using mysql query

Postby usrb » Tue Feb 10, 2015 7:59 pm

Great men, that fixed the php syntax issue and no errors in error.log any more.
But now, I don't have values in column ap_hostname... Do you have an idea where are values gone? :)
usrb
 
Posts: 12
Joined: Mon Nov 07, 2011 6:00 pm


Return to Open Discussion

Who is online

Users browsing this forum: Majestic-12 [Bot] and 10 guests

cron