MYSQL QUERY

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
User avatar
pavanpuligandla
Forum Contributor
Posts: 130
Joined: Thu Feb 07, 2008 8:25 am
Location: Hyderabad, India

MYSQL QUERY

Post by pavanpuligandla »

hii all..
here is mysql query:

Code: Select all

$query="SELECT Login, customerID FROM ss_customers WHERE Login='" . mysql_real_escape_string($Login) . "'";
how can i print customerID from the above table?
User avatar
becky-atlanta
Forum Commoner
Posts: 74
Joined: Thu Feb 26, 2009 6:26 pm
Location: Atlanta, GA

Re: MYSQL QUERY

Post by becky-atlanta »

Here is an example:

Code: Select all

 <?php
// Make a MySQL Connection
mysql_connect("localhost", "admin", "1admin") or die(mysql_error());
mysql_select_db("test") or die(mysql_error());
 
// Retrieve all the data from the "example" table
$result = mysql_query("SELECT * FROM example")
or die(mysql_error());  
 
// store the record of the "example" table into $row
$row = mysql_fetch_array( $result );
// Print out the contents of the entry 
 
echo "Name: ".$row['name'];
echo " Age: ".$row['age'];
 
?> 
You can find more explanation and examples here:
http://us3.php.net/function.mysql-query
Post Reply