Hello,
I have a mysql query that is selecting from the database, I just do not know how to echo it. Would you simply just…
<?
$query == mysql_query("SELECT * FROM `announcements`");
echo '';
?>
Thanks in advance,
Bobby
Hello,
I have a mysql query that is selecting from the database, I just do not know how to echo it. Would you simply just…
<?
$query == mysql_query("SELECT * FROM `announcements`");
echo '';
?>
Thanks in advance,
Bobby
This is what I’ve got now.
Array ( [announcements] => fhgsajgasjgjgjdsahjsahjsdafhnjasfdjhasdjfjasdfjasdjgbasjdhbjasjhnasfnjnj )
The jibberish at the end is what is in my database… Now, how do I get rid of the "Array ( [announcements] => and the ) at the end?
here is my code:
<?
$query = mysql_query("SELECT * FROM `announcements`");
while($row=mysql_fetch_assoc($query)) {
print_r($row);
}
?>
Thank you so much for all of your help!
It works!
<?
$sql = "SELECT * FROM `announcements`";
echo $sql;
$query == mysql_query($sql);
?>
First off…
$query == mysql_query("SELECT * FROM `announcements`");
the variable $query is not correctly defined here meaning your link isn’t even working… the double equal (==) is comparing which is then thrown away since it’s not assigned to anything.
Try this:
$query = mysql_query("SELECT * FROM `announcements`");
while($row=mysql_fetch_assoc($query)) {
print_r($row);
}
If you know the column name “announcements” (same as the table?!) you just do this:
<?
$query = mysql_query("SELECT * FROM `announcements`");
while($row=mysql_fetch_assoc($query)) {
echo $row['announcements']; //change announcements to the correct column name
}