Hi all,
I want to SELECT * FROM Music_Library, so that it will return all the fields in my database. But it only returns the first field. Anyone knows why?
code:
<?php
require ("include/mysql_conf.php");
// To connect to MYSQL:
//Attempt to connect with database
if (!($link=mysql_connect($hostname, $username, $password)))
{
printError(sprintf("Error connecting to database. Please
check SQL settings:\n
Hostname: %s\n
Username: %s\n
Password: %s\n", $hostname, $username, $password));
exit();
}
//To select the database:
//Make $dbname the active database
//-------------------------------------
if (!mysql_select_db($dbname, $link))
{
printf("Error making the database <b>%s</b> active", $dbname);
printf("error:%d %s", mysql_errno($link), mysql_error($link));
mysql_close($link);
exit();
}
// You should also keep the connection to MySQL connection open in order to
// reduce overhead and achieve faster queries and system performance.
// To keep an active connection to MySQL:
// Attempt to create persistent connection with database
if (!($link=mysql_connect($hostname, $username, $password)))
{
printf("Error connecting to database. Please check SQL settings:\n
Hostname: %s\n
Username: %s\n
Password: %s\n", $hostname, $username, $password);
exit();
}
//$query = "SELECT * FROM Music_Library";
//$query = "SELECT * FROM Music_Library WHERE title = $find";
$getresults = mysql_query("SELECT title FROM Music_Library WHERE title LIKE '%$find%'");
$resultsnumber = mysql_numrows($getresults);
IF ($resultsnumber == 0){
PRINT "Your search returned no results. Try other keyword(s).";
}
ELSEIF ($resultsnumber > 0){
PRINT "Your search returned $resultsnumber results<BR><BR>";
for($count = 0; $count<$resultsnumber; $count++){
$body = mysql_result($getresults,$count);
//tighten up the results
$body2print = $getresults;
$cnote = $count+1;
PRINT "$cnote. <a href=http://www.radio.deltapath.com/dedicationmail.php>
<i>$body2print</i></a><BR>";
}
}
?>
[This message has been edited by shattered (edited 03-11-2003).]
[This message has been edited by shattered (edited 03-11-2003).]