lua - Luasql fetching some weird values from my mariadb database tables -


i have mariadb database named linux_krozki has table named stranke. table has column ime holds customers name , holds 2 customers.

enter image description here

now trying print customers names using luasql, kind of new object programming. managed write down far:

-- include module written in c. if written in lua use  -- "package.path" instead package.cpath = package.cpath .. ";/usr/lib/i386-linux-gnu/lua/5.1/?.so"  -- order luasql require driver mysql luasql = require "luasql.mysql"  -- order object "luasql" ask connection mysql driver env = assert (luasql.mysql())  -- pass login info driver con = assert (env:connect("linux_krozki","root","mypassword"))  -- order connection execute sql query , save cursor cur = assert (con:execute("select * stranke"))  -- save cursor value variable "vnos" vnos = cur:fetch ({}, "a")  -- continue until table has rows while vnos    -- print variable "vnos"   print(string.format("ime: %s", vnos))    -- again transfer value cursor variable "vnos"         vnos = cur:fetch (vnos, "a") end 

i saved test.lua , when execute code lua test.lua output:

ime: table: 0xbd63a0 ime: table: 0xbd63a0 

i noticed number of rows in table match lines of output, while values table column ime wrong... if add user table output changes to:

ime: table: 0x23823a0 ime: table: 0x23823a0 ime: table: 0x23823a0 

i wrote down comments -- in code can see how interpret object programming. hope imy interpretation ok, still there missing...


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -