Link to home
Start Free TrialLog in
Avatar of error77
error77

asked on

Javascript / JQuery / PHP Query

Hi all,

I need some direct, simple sample code to do the following.

Pages would be:

1. index.html
2. index.php

The index.html uses Jquery / Ajax to call the php and thr index.php queries the database and my index.html then displays the results.

Basically, I just need to php file to do the connection / query and the html / javascript page would do the rest?

The Database is MySQL by the way ...

Can anyone help please?

I just need the pure working basics for I can userstand it.

Thanks

Any suggestions
Avatar of Lukasz Chmielewski
Lukasz Chmielewski
Flag of Poland image

Wouldn't it be easier to use only the php files ? Why additional html ?
Could you be more specific about the queries or the files, the code ? Do you have any ?
You can put everything in one php file, jQuery, JS, PHP - in my opinion it would be better to debug.
If you want the page to be accessible from browser as HTML file then you can do that later via HTACCESS ... and for now, as @Roads_Roads said, I think it will be better to work it on 1 PHP file.
Avatar of error77
error77

ASKER

It's for use on a mobile so basically I can only use HTML, Javascript and CSS ... So ehat I thought was to query a online php file or something ... unless have a better suggestion? All the data is on an online database and I need to get it but cannot use php only html and javascript on the mobile.
Avatar of error77

ASKER

Anyone please?
So the html page would have some kind of form right ?
Avatar of error77

ASKER

Yes
If you have it written in a PHP file and able to access it from regular browser as
http://yoursite.com/yourfile.php

Next, add a .htaccess to the root and fill this:
RewriteEngine on
RewriteBase /
RewriteRule ^(.*)\.html$ $1.php [L]

Open in new window


And then the same file above is accessible through
http://yoursite.com/yourfile.html

Try it...
Avatar of error77

ASKER

Sorry, onemadeye, I don't think you understood my question. I'm not looking into htaccess issues, I need to connect to an sql database using html / ajax into a php ... html / ajax being local ... and a request being made to the php file which is remote.
Nope, I think you dont understand the solution that i gave...
You're looking for 50+50=100 and I come up with 25+75=100 and you said I'm wrong?

But ok, let just do this your way, as said you need to connect to an sql database using html / ajax into a php ... html / ajax being local ... and a request being made to the php file which is remote.
And how do you want us to grant you a solution??
What have you achieve so far? How bout let us know your codes so far?
ASKER CERTIFIED SOLUTION
Avatar of Lukasz Chmielewski
Lukasz Chmielewski
Flag of Poland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of error77

ASKER

Thanks!

p.s: onemadeye, didn't mean't for you to get offended. I'm sure your solution is fine and works but it wasn't what I was looking for. I was looking for HTML and PHP code. Thanks again.