24

Is there an online phpFiddle and sqlFiddle that work together so that I can do something with the test sql data?

Using http://phpfiddle.org/ and http://sqlfiddle.com/ but would be great if they could work together.

I'm sure someone out there has created an all-in-one SQL, PHP and JS fiddle. No?

Craig
  • 2,093
  • 3
  • 28
  • 43
  • 11
    XAMPP /localhost ? – AlienWebguy Sep 12 '12 at 23:40
  • 1
    Yes I have my own server, just though it would be nice to be able to quickly make changes and play around without having to upload every couple of secs and modify the database. – Craig Sep 12 '12 at 23:43
  • From phpfiddle create mysql temporary tables and query them, although you would need to open a connection to some mysql server, but could be an account setup by phpfiddle crew with no tables, or you could connect your mysql server remotely. Temporary tables disappear once the connection is closed. – Nelson Sep 12 '12 at 23:51
  • I've thought about what it would take to bring SQL fiddle to other backends (rubyfiddle? codecademy? etc...). Haven't figured it out quite yet, though. – Jake Feasel Sep 12 '12 at 23:52
  • 1
    Yes I think it would be great to have a project site that is a bunch of "fiddles" that work together. Would make collaboration very easy and would allow people without the tools to just jump in and start programming. Also great if you are away and can just jump on a computer with Internet access and continue working. Then once you have a working product then move it to your own server etc. – Craig Sep 12 '12 at 23:56
  • 3
    strange that still there is no such fiddles after 4 years..... – fresher Oct 26 '16 at 05:49
  • Of course, nowadays, http://phpfiddle.org/ covers this. It's a great way to share with others (unlike `localhost`), and is widely used on this site – Mawg says reinstate Monica Aug 18 '20 at 06:26

6 Answers6

13

Okay, so this isn't exactly what you asked for, but it's close.

http://jsfiddle.net/S3DR9/

Here you can see a JS Fiddle that is successfully calling out to SQL Fiddle with AJAX (now possible as a result to my apache config to allow this to go through). All you have to have is a SQL Fiddle hash fragment (everything after the #; for example this SQL Fiddle link http://sqlfiddle.com/#!2/a2581/1 has the has fragment of !2/a2581/1) and you can see how I pass that into the URL to get back the JSON response. The rest of the code in that JS Fiddle link is just parts I've taken from my main codebase, simplified as needed. I would imagine this is enough to see the basics, as far as how to put it together.

Now, it would be a whole 'nother exercise to try to wrap up such a call to SQL Fiddle in a PHP library of some sort that attempted to emulate an actual database driver. I would think that would be the sort of thing you'd want to do in a php sandbox, so you could simulate an actual db call. If someone is interested in building that out, let me know.

Jake Feasel
  • 16,785
  • 5
  • 53
  • 66
3

At the time of writing this, I think there is no combined (php/db) fiddle tools like that. Would be quite useful to have this online tool alright.

I think the best you can do at the moment is to just have your portable server, Apache, Mysql db or you can use XAMPP portable. Something that you can run in your USB.

There are benefits on having a portable version, instead of online fiddles.

  • you could run codes faster, no need to wait for the outputs online
  • even if you have slow net, or no internet you can still code.
  • You can code in your favorite IDE
  • hmm, what else guys?

then you can also integrate it into dropbox, if you are after the online sharing of urls

fedmich
  • 5,343
  • 3
  • 37
  • 52
  • You can also create batch files to start/stop the apache and mysql services if you want. I think Xampp portable have this already in there. – fedmich Sep 21 '12 at 03:02
3

You could connect PHP fiddle to dropbox and then use a file based database like sqlite.

Relequestual
  • 11,631
  • 6
  • 47
  • 83
2

The PHPize.online have all demanded functionality. It's provide SQL fiddle (MySQL 5.7/8.0, MariaDB 10, PostgreSQL 11-14, SQLite 3 and MS SQL 2017/19) with PHP fiddle (5.6, 7.4, 8.0).

PHPize.online is a free online environment for quickly running, experimenting with and sharing PHP and SQL code. You can run your SQL code on top of most popular RDBMS, and run PHP code that can use the same DB. For database usage you can use pre-defined instanses of PDO ($pdo) & mysqli ($mysqli).

Slava Rozhnev
  • 9,510
  • 6
  • 23
  • 39
0

Yes - Glitch

A service to help demo code called Glitch helped me demo a NodeJS answer on Stack Overflow along with PHP/SQLite and JS files for a PHP answer. It works with recent editors and is built off of variety of Server flavors such as NodeJS or PHP. Application demos use SlimPHP framework for the PHP projects. You can add edit files and publish output online as well as share live results with code.

Searching on glitch for a sample SlimPHP, SQLite demo returned this project that you can fork from.

https://glitch.com/~notarazi-slim-php-sqlite

Vahe
  • 1,699
  • 3
  • 25
  • 76
-1

I'm a knob, a neophyte, a hack that messes with code to see if I can get it to work (i.e. I'm not a "developer").

I use Wordpress, with a Code Manager plugin to create the environment with my hosting company. I have Code manager open in one tab to fiddle, another tab displays a page with the needed shortcode from Code Manager to view results.

I use available fiddles to test parts of the code (JSFiddle, PHP sandbox, SQL Fiddle) and then put them together in the Wordpress environment.

Kinda convoluted but gets the job done.

ACKmiecik
  • 70
  • 8