Page 1 of 1

MYSQL QUERY

Posted: Sat Mar 28, 2009 2:38 pm
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?

Re: MYSQL QUERY

Posted: Sat Mar 28, 2009 9:11 pm
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