how to read data from MySQL?
Posted: Fri Apr 16, 2004 11:42 am
Ok, dont flame me! I know, this is realy stupid question, but I only know how to instert data. can you give me some small code how to read data from database!! thank you! 
A community of PHP developers offering assistance, advice, discussion, and friendship.
http://forums.devnetwork.net/
Code: Select all
<?php
$query = "SELECT column1, column2 FROM table WHERE column3=value";
?>Code: Select all
<?
error_reporting(E_ALL);
$db = mysql_connect('localhost','root','q54fgh546') or die(mysql_error());
mysql_select_db("mydatabase") or die(mysql_error());
$query = "SELECT firstname FROM users";
echo mysql_query($query) or die(mysql_error());
mysql_close();
?>Code: Select all
echo mysql_query($query);absolutely, its no good me / us telling you what to do, you'll never learn that way, read the docs, they explain everythingmagicrobotmonkey wrote:you might want to give this a gander:
http://us2.php.net/manual/en/function.m ... -array.php
and the rest of the docs while you're at it!