Get Data base from php file

by 11 replies
13
Hi all,

Any buddy know of any apps or some one that can extract database from php files


Thanks
#programming #base #data #file #php
  • hey.. what do you mean by extract db from php files?
  • i know there are programs that can make a database from a php file
    • [1] reply
    • Do you want a database to be generated from a php file? (AKA CREATE DATABASE CALLS) or to pull db schema and each row from every table?
  • Sounds like a wee bit of confusion here!

    @Gdubbs316 - what are you actually asking here? PHP is a programming language, it can interface with several common database applications but it's just a programming language. You can write a PHP script to create a database, usually by calling an external SQL file that contains the create table statements. But you don't "extract" databases from PHP code!

    If you can clarify your requirements we may be able to assist you.

    Bill
    • [1] reply
    • Hii..Is any one know how to extract a file extension in php??




  • This rather depends on whether the php files are on your own website (that is you can upload and download them). If they are on another person's website where you don't have legal access to the php files, the files can't be 'reverse engineered'.

    If you do have access to the relevant database, then you can write short sets of instructions, whether in php or any other language such as asp, Python, Java etc.

    You will nearly always be required to enter a username and password when dealing directly with a database. If you don't know these then you will have to find some code that has them embedded and use the code to get access. That code is the 'set of instructions' above.

    It is very simple for any halfway competent programmer to insert, delete, extract copies of the data and so on. They will simply need to write the code as in the above para. However, they cannot do this for you unless you can supply the a password and username for a database account with the relevant permissions.

    The question is:

    Do you want a programmer (to whom you will supply relevant credentials) to set up the code for you to access the database and read off the data as required?

    If not, perhaps you have a php source file (similar to an html file) where a table/data-like structure is hard-coded into the file. Again, it's easy to get data from that situation, simply by copy/pasting the data of interest.

    Or perhaps you don't have access to the to the php file at all, except as rendered by your browser? From your browser you can view the source file but when dynamic elements such as php calls are embedded, you are likely to see the results but not the php code. For instance the following code:



    Would give the following when you do a view source:

    (note the php code is now hidden)


    And would have a webpage showing as:


    As you can see, extracting stuff from php files requires you to have direct access to those files. If you can only see the relevant page that the php produces in the browser, you can't extract from the php.

    So, considering the above, which are you wanting to do, and do you have the required permissions to do it?

    Pat
  • Maybe this will do what you want.

    There are two PHP scripts RSS2SQL and SQL2RSS that will either extract from RSS and pull data into a database or vice versa. You can find additional details at RSS2SQL Converts RSS Feeds to Databases or SQL2RSS Converts MySQL to RSS Feeds

    HTH
  • While I don't know what database you had in mind, here is sample code to connect to a MySQL database and extract rows from a table:

    Code:
    <?php
    
    $db_server = 'localhost'; // Server Address For Your MySQL Database
    $db_username = 'USERNAME HERE'; // Database Username
    $db_password = 'PASSWORD HERE'; // Database Password
    $db_name = 'DATABASE NAME HERE'; // Database Name
    
    mysql_connect($db_server, $db_username, $db_password) or die(mysql_error()); // Connect to MySQL
    mysql_select_db($db_name) or die(mysql_error()); // Select the "$db_name" Database
    
    // Execute Your Query
    $result = mysql_query('SELECT * FROM tablename') or die(mysql_error());
    
    // Extract Rows That Match Your Query
    while($row = mysql_fetch_array($result))
    {
    	// Echo The Contents Of Each Row
    	foreach($row as $key=>$val)
    		echo $key.'=>'.$val.'<br />';
    }
    
    ?>
  • i was looking for a program for a script i have i lost the database on a server crash
  • So you are trying to recover a database that no longer exists and you have no backups of?
    You're screwed.
    The php files contain the code that access the database. They do not contain any of the actual data.
  • Thank You
    You have answered a question that I didn't have to ask!
    G.W.

Next Topics on Trending Feed