good morning,
after woking almost all night on connector and grid i guess i understood where to put files on project but i have still a problem.
i wrote this simple php file:
<?php
require("conn_codebase/grid_connector.php");
$res=mysql_connect("localhost","root","");
$database = mysql_select_db("clown");
$gridConn = new GridConnector($res,"MySQL");
$gridConn->render_table("comuni","Codice","Citta,Provincia,NomeProvincia");
?>
i checked that if i open a browser page at
localhost/xampp/prova.php
the page works because i put an echo condition to check if database were connected or not.
The problem is that when i load this file with grid.load(“prova.php”) a popup appears showing the text of my prova.php file.
Why this popup appear? i can’t load any data in this way… where is the problem?
i underline that i added connector.js and all necessary libreries.
Please help me…
thanks to all
Be sure that you are loading sample page by http and not directly from file system
The script used in some.load(…) command , will be called exactly the same, if it was opened directly from browser, and must return the same value.
how can i be sure that i load the file from http and not directly from file system?
i use a grid to load my data and i used:
grid = layout.cells(“a”).attachGrid(); (because this gris is inside a layout)
grid.load(“prova.php”);
my prova.php file is in the same directory where is the html file.
is there something wrong?
Above code is fine.
how can i be sure that i load the file from http and not directly from file system?
Next URL is fine
some.com/some/index.html
Next one, is a direct loading and will not work
file:///D:/http/some/index.html
thanks for your help,
i got the difference. I created a database on my pc and i load my html page as follow:
127.0.0.1:8888/
i guess it’s the correct way to load the database but there is still somthing wrong. infact when i load the page a pop up opens but this time in the pop up there isn’t the php text but the follow:
<?xml version='1.0' encoding ='utf-8'>
and so on, and the data are exaclty the data i have in the database.. seems that it created a xml file but it's not loaded in the grid but it shows a popup with the text above.
what should be the problem now?
thanks again for your support
XML is not valid.
There are few possible reasons.
To get more details - load the same ulr, which generates xml feed, directly in browser. It will show more detailed error. Most probably data is not UTF-8 ( connector has set_encoding method for such case )
once again i guess i’m gonna get mad.
if i load my php file directly on browser i obtain all rows with the cell i selected but not of the all database. if my database arrive till letter “Z” the rows on brows arrive at “C”.
how can i set the right encoding or how can i check something else to discover the error?
IF you are not using UTF encoding for data , just add
$grid->set_encoding(“iso-8859-1”)
before render_data command.
If issue still occurs - provide a sample of problematic xml data.