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!
Hey i am trying to create a page that builds a 3 column table from a mysql database.
the way i have it setup is that all the mysql connection and query is done with in one page and then i have it process to include the actual page that outputs what is seen. so i have i query that pulls the info from mysql then it runs a few if statements if the result is incorrect or it is empty it out puts the search form. and if it gets info it outputs the table. At this point i want to be able to have a filter option for the mysql query so the table can be filtered. i am doing this be creating an select option in the table head with a while statement.
while ($row = mysql_fetch_array($result))
{
echo ("<option value=/"$row['city']/">$row[city]</option>\n");
}
I have this under the city column in the table. THe problem is that it only process this statement and seems to quit. It will not process the table or any of the other information after that bit of code.
Look at the source code of the page, there is a chance that there is a PHP error in the select box and it's screwing with your HTML. For instance, your $row[city] will throw a E_NOTICE since it's not a constant.
dzynit wrote:Are you sure it's not simply a typing error? $row['city']/">$row[city] the second $row[city] doesn't have the ' marks.
I don't doubt that there isn't a constant "city", I was just pointing out that PHP will think it's a constant, thus throwing a E_NOTICE which could break his HTML rendering.
Yes what happens is that the one option list populates and nothing else. and the typing error here is just here. The code is actually processed through an error checking that i have create the actual script in the page is
<?PHP
while ($row = $connector->fetchArray($result)) {
echo ("<option value=\"$row['city']\">$row['city']</option>\n";)
}?>
where the connector actual does do mysql error checking and the process the request. I am hoping it is not a mysql error. I don't get any errors it just will stop processing any php after this block of code
synking wrote:Yes what happens is that the one option list populates and nothing else. and the typing error here is just here. The code is actually processed through an error checking that i have create the actual script in the page is
<?PHP
while ($row = $connector->fetchArray($result)) {
echo ("<option value=\"$row['city']\">$row['city']</option>\n";)
}?>
where the connector actual does do mysql error checking and the process the request. I am hoping it is not a mysql error. I don't get any errors it just will stop processing any php after this block of code
yes sorry thought i had it printed perfectly i am sorry. the thing is i never get any error it prints the start of the table gets to the option field creation it prints nothing else.
synking wrote:yes sorry thought i had it printed perfectly i am sorry. the thing is i never get any error it prints the start of the table gets to the option field creation it prints nothing else.
Ok i found out what the problem was i was not resetting my result from the MYSql query so it was working but there was no information to pull as the first while left off at the end of the mysql table. So i just had to reset the result. thanks guys.
synking wrote:Hey i am trying to create a page that builds a 3 column table from a mysql database.
the way i have it setup is that all the mysql connection and query is done with in one page and then i have it process to include the actual page that outputs what is seen. so i have i query that pulls the info from mysql then it runs a few if statements if the result is incorrect or it is empty it out puts the search form. and if it gets info it outputs the table. At this point i want to be able to have a filter option for the mysql query so the table can be filtered. i am doing this be creating an select option in the table head with a while statement.
while ($row = mysql_fetch_array($result))
{
echo ("<option value=/"$row['city']/">$row[city]</option>\n");
}
I have this under the city column in the table. THe problem is that it only process this statement and seems to quit. It will not process the table or any of the other information after that bit of code.