Get Data base from php file

11 replies
Hi all,

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


Thanks
#base #data #file #php
  • Profile picture of the author Shounak Gupte
    hey.. what do you mean by extract db from php files?
    Signature
    Looking for a quality but affordable graphic designer to partner with. To express your interest PM me with some samples.
    {{ DiscussionBoard.errors[2354757].message }}
  • Profile picture of the author Gdubbs316
    i know there are programs that can make a database from a php file
    {{ DiscussionBoard.errors[2354795].message }}
    • Profile picture of the author sdwrage
      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?
      {{ DiscussionBoard.errors[2355077].message }}
  • Profile picture of the author mywebwork
    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
    {{ DiscussionBoard.errors[2355377].message }}
    • Profile picture of the author agrajtech11
      Hii..Is any one know how to extract a file extension in php??





      {{ DiscussionBoard.errors[2359657].message }}
  • Profile picture of the author wisywig
    Originally Posted by Gdubbs316 View Post

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

    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:

    <html>
    <head></head>
    <body class="page_bg">
    Hello, today is <?php echo date('l, F jS, Y'); ?>.
    </body>
    </html>


    Would give the following when you do a view source:
    <html>
    <head></head>
    <body class="page_bg">
    Hello, today is Monday, July 19th, 2010.
    </body>
    </html>

    (note the php code is now hidden)


    And would have a webpage showing as:

    Hello, today is Monday, July 19th, 2010.


    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
    {{ DiscussionBoard.errors[2360482].message }}
  • Profile picture of the author ButterflyGarden
    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
    {{ DiscussionBoard.errors[2360551].message }}
  • 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 />';
    }
    
    ?>
    {{ DiscussionBoard.errors[2360750].message }}
  • Profile picture of the author Gdubbs316
    i was looking for a program for a script i have i lost the database on a server crash
    {{ DiscussionBoard.errors[2363447].message }}
  • Profile picture of the author KirkMcD
    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.
    {{ DiscussionBoard.errors[2364996].message }}
  • Profile picture of the author G.W.
    Thank You
    You have answered a question that I didn't have to ask!
    G.W.
    Signature
    {{ DiscussionBoard.errors[2366919].message }}

Trending Topics