Thread: Databases
View Single Post
  #4  
Old 10-02-2004, 05:01 PM
PHP-Largo
Unregistered

Posts: n/a

[quote:eca061018e="PHP-Largo"]<?php
$sql = mysql_connect("host","username","password");

mysql_select_db("Db name",$sql);

$result=mysql_query("SELECT * FROM tablename");
//pull it out
while($myrow = mysql_fetch_array($result)) {
printf("$myrow[somename]");
}
?>[/quote:eca061018e]
forgot: it should have the debug : here is the code:
[code:1:eca061018e]<?php
$sql = mysql_connect("host","username&quot ;,"password")
or die("could not connect");
mysql_select_db("Db name",$sql)
or die("could not select DataBase");


$result=mysql_query("SELECT * FROM tablename")
or die("could not execute query");
//pull it out
while($myrow = mysql_fetch_array($result)) {
printf("$myrow[somename]");
}
?>[/code:1:eca061018e]
Reply With Quote