Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help: SQL without phpmyadmin?
#2
You'll need to write an PHP code for that, first you'll need to connect to the database and then fetch resuls... and show them.

PHP Code:
<?php

$db 
= array(
    
'host' => 'localhost'// your host
    
'user' => 'root',   //username
    
'pass' => '',       //password
    
'base' => 'test' //database name not table
);


// connecting to the database
if($connect mysql_connect($db['host'], $db['user'], $db['pass'])) {
    
// selecting the database
    
if(!$sel mysql_select_db($db['base'])) {
        die(
"Connection failed..<br />".mysql_error());
    }
}

//sql query string
$sql "SELECT * FROM `people`";
//execute sql query
if(!$query mysql_query($sql)) {
    die(
mysql_error()); // die and show error
}

//if mysql_num_rows returns 0 there isn't anything in the table
if(mysql_num_rows($query) <= 0) {
    die(
"There are no entries in the database");
}

//fetch result from the query
while($rows mysql_fetch_array($query)) {
    echo 
$rows['id']." : ".$rows['name']." : ".$rows['telephone']." : ".$rows['birthday']."<br />";
}


//close connection
mysql_cl($connect);

?>
Reply


Messages In This Thread
Help: SQL without phpmyadmin? - by nevets04 - 12-24-2009, 01:06 AM
RE: Help: SQL without phpmyadmin? - by Gaijin - 12-24-2009, 07:46 AM
RE: Help: SQL without phpmyadmin? - by nevets04 - 12-24-2009, 12:28 PM
RE: Help: SQL without phpmyadmin? - by Gaijin - 12-24-2009, 12:29 PM
RE: Help: SQL without phpmyadmin? - by nevets04 - 12-24-2009, 12:38 PM
RE: Help: SQL without phpmyadmin? - by Gaijin - 12-24-2009, 12:44 PM
RE: Help: SQL without phpmyadmin? - by nevets04 - 12-24-2009, 01:04 PM
RE: Help: SQL without phpmyadmin? - by wat - 12-30-2009, 11:47 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  how to open a 750 mb database,sql file? etc 17 7,468 08-21-2011, 03:57 AM
Last Post: AceInfinity
  Why not use this to help prevent SQL injection? ★Cooldude★ 29 13,798 06-30-2011, 07:06 AM
Last Post: ControL1
  Help. Having trouble logging into phpmyadmin. nevets04 4 2,041 12-24-2009, 12:08 AM
Last Post: nevets04
  SQL Interacting with Form Cppsean 3 1,650 10-19-2009, 12:21 PM
Last Post: Omniscient

Forum Jump:


Users browsing this thread: 1 Guest(s)