PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
<?php
//open connection
$conn = mysql_connect("db949.perfora.net", "dbo207711380", "######");
// pick the database to use
mysql_select_db('db207711380',$conn);
//create sql statement
$sql="SELECT flavor from flavors WHERE Al_Ajamy IS NOT NULL ORDER BY flavor";
$result=mysql_query($sql,$conn) or die(mysql_error());
while($newArray=mysql_fetch_array($result)){
$flavor=$newarray['flavor'];
echo "$flavor <br/>";
}
?>
it comes up blank I dont get why it is doing it. I keep editing things and cant figure out what Ive done wrong.
Thanks for the help ahead of time.
EDIT: I changed to IS NOT NULL and it still is blank
Last edited by slomotion on Fri Jun 22, 2007 9:39 pm, edited 1 time in total.
I think its in my while loop because when i plug in the SELECT code in phpmyadmin it brings up the proper list. I dont know what it could be but just thought I would try to help you help me
I dont know how many times it loops. is there a way to figure it out? //beginner here
when it loads, it doesnt really it just stays blank and doesnt have any error message.
its suppost to loop like 30 times, is the amount of data that should be displayed.
<?php
//open connection
$conn = mysql_connect("db949.perfora.net", "dbo207711380", "###PASS###");
// pick the database to use
mysql_select_db('db207711380',$conn);
//create sql statement
$sql="SELECT flavor from flavors WHERE Al_Ajamy IS NOT NULL ORDER BY flavor";
$result=mysql_query($sql,$conn) or die(mysql_error());
while($newArray=mysql_fetch_array($result)){
$flavor=$newarray['flavor'];
echo "$flavor <br>";
}
?>
superdezign wrote:
If you look at the mysql_fetch_array() documentation, you'll see that it does, in fact, return an associative array as well as a numerical.
I think that's what astions meant.
BTW, the ORDER BY is unnecessary, your SELECT only names one column, `flavor`, there is no reason to ORDER BY `flavor` unless you want to ORDER BY DESC (descending).