Hi..Wanna ask if someone knows how to retrieve records in database in PHP...I want that if i click the "retrieve button" all records will retrieve..I'll use retrieving when disaster occurs..tnx in advance.. :)

I have 5 PHP programs that work as web sites
window XP Prof SP3
(1) pilot's logbook access MySQL
(2) pilot's logbook access Oracle
(3) pilot's logbook access sql server 2008 express
Fedora 12
(1) pilot's logbook access MySQL
(2) pilot's logbook access Oracle

I can email

Voltaire: If God did not exist, it would be necessary for us to invent Him
GOD: If Voltaire did not exist, it would be necessary for us to invent him

?
Archives are usually used for disaster recovery!
That is such a genaral question, i don't think ther is an answer.

That's a big question, are you using msql? If so I may be able to help.

H

u dont need php script just to retrieve records... all you have to do is go to phpmyadmin and then export database and a sampledatabase.sql will be given to you. dont worry... its not a big file... it's just a plain text...

and you can get your database back via import.

That is great! The resulting sql can regenerate the table with all constarints...right?

I presume you are talking about MySQL...right??

In MS SQL Server and Oracle, one can save a table(at least) and all constraints in XML.

Don't know about MySQL!

?
Archives are usually used for disaster recovery!
That is such a genaral question, i don't think ther is an answer.

oh ok..How can i work with that archive in php?

u dont need php script just to retrieve records... all you have to do is go to phpmyadmin and then export database and a sampledatabase.sql will be given to you. dont worry... its not a big file... it's just a plain text...

hmmm no i know what you're talking about with the phpadmin..but what i mean is when im done in my program,there's no more wamp server installed..only the program.website..coz i have my control panel.

try this:

<?php
mysql_connect("localhost","dbusername","dbpass");
mysql_select_db("databasename");

$sql = mysql_query("SELECT * FROM `tablename`");
$results = mysql_fetch_array($sql);

print_r($results);
?>

Is this what you want?

try this:

<?php
mysql_connect("localhost","dbusername","dbpass");
mysql_select_db("databasename");

$sql = mysql_query("SELECT * FROM `tablename`");
$results = mysql_fetch_array($sql);

print_r($results);
?>

Is this what you want?

no i just wanna know the code in retrieving records saved in database or maybe the right code for archiving records in php..

Oh well nice to see some code in this thread.
Here is some of the same if it is php Mysql you are looking for.

<?php
include ("../includes/dbconnect.php");
$tableName ="your_table";
$this = "this";
$sql="SELECT * FROM $tableName WHERE $this = 'this' ORDER BY first ASC";
$result=mysql_query($sql);
$rows=mysql_fetch_array($result);
while($rows=mysql_fetch_array($result)){ 
$result = this that and the other
?>

The SELECT * FROM this that and the other your_table_name is something to look at.
also would be good to know some more about the original question Hope to be useful H

Above code is fine. Try it please

unless you've used

INSERT * INTO your_table

and or

<form action="retrieve_file.php"

or something like it, we may be a bit off the track.

H

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.