goldfish
07-28-03, 12:55
Okay..... what up wid this...
My main file...
<?php
include("top.php");
include("db_connect.php")?>
allor <br>
<?php
$sql = 'SELECT * FROM `users`';
$result = mysql_db_query($dbname,$sql,$connection) or
die("Error in query");
// with a while loop
// this loop will iterate as many times as there are records
while($myrow = mysql_fetch_array($result))
{
$userrname = $myrow["usrname"];
$password = $myrow["pwd"];
echo "$username ... $password <br>";
}
mysql_free_result($result);
?>
<?php include("bottom.php"); ?>
right, my top file has all sorts of funky layout stuff, and so does the bottom file. the dbconnect has.....
<?php
function db_connect() {
$dbuser = "my user name ;)";
$dbpass = "no chance!";
$dbname = "wouldnt you like to know"
$dbhost = "localhost";
$connection = mysql_connect($dbuser, $dbpass, $dbname, $dbhost)
if(!$connection) {
echo( "Unable to connect to the database");
exit();
}
else {
$connected_to_db = "Connected to Database";
}
}
?>
right... the table does exist, and it has an entry in it. it dies (i.e. it echos "error in query" ) and i cant figure out why
My main file...
<?php
include("top.php");
include("db_connect.php")?>
allor <br>
<?php
$sql = 'SELECT * FROM `users`';
$result = mysql_db_query($dbname,$sql,$connection) or
die("Error in query");
// with a while loop
// this loop will iterate as many times as there are records
while($myrow = mysql_fetch_array($result))
{
$userrname = $myrow["usrname"];
$password = $myrow["pwd"];
echo "$username ... $password <br>";
}
mysql_free_result($result);
?>
<?php include("bottom.php"); ?>
right, my top file has all sorts of funky layout stuff, and so does the bottom file. the dbconnect has.....
<?php
function db_connect() {
$dbuser = "my user name ;)";
$dbpass = "no chance!";
$dbname = "wouldnt you like to know"
$dbhost = "localhost";
$connection = mysql_connect($dbuser, $dbpass, $dbname, $dbhost)
if(!$connection) {
echo( "Unable to connect to the database");
exit();
}
else {
$connected_to_db = "Connected to Database";
}
}
?>
right... the table does exist, and it has an entry in it. it dies (i.e. it echos "error in query" ) and i cant figure out why