snowdog Posted January 26, 2012 Share Posted January 26, 2012 I haven't coded in about a year and am a little rusty. Here is the code. I have turned error reporting on but for some reason it is not working on my server. <?php // Load The dealers in for the franchisee include("include/db_connect.php"); SESSION_START(); $franchise_id = $_SESSION['franchise_id']; // Query the database and get dealers $SQL = "SELECT * FROM dealers WHERE franchise_id = '$franchise_id' ORDER BY name ASC"; $result = mysql_fetch_array($SQL) or die(mysql_error()); while($run = mysql_fetch_array($result)) { ?><option value="<? echo $run['id']; ?>"><? echo $run["name"]; ?></option> <? } ?> Quote Link to comment Share on other sites More sharing options...
Psycho Posted January 26, 2012 Share Posted January 26, 2012 Please be specific by what is meant by "Not working". Are you getting ANY output. If so, how does that output differ from your expectations? Did you look at the HTML source code in your browser to see what is in there that isn't directly displayed in the page? If you are not getting any errors it could be: 1. The server does not have PHP installed so the file is sent as a plain HTML file and the PHP code will not be displayed in the browser because the PHP tags are treated like HTML tags. 2. The query is not returning any results Quote Link to comment Share on other sites More sharing options...
Julius Posted January 26, 2012 Share Posted January 26, 2012 $result = mysql_fetch_array($SQL) or die(mysql_error()); You didn't execute query. Replace that line to this $result = mysql_query($SQL) or die(mysql_error()); Also, use <?php ?> instead of <? ?> Quote Link to comment Share on other sites More sharing options...
snowdog Posted January 26, 2012 Author Share Posted January 26, 2012 Thanks Julius, stupid mistake. Sometimes it is hard to wee when you write it yourself. At least i have that problem anyway. Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted January 27, 2012 Share Posted January 27, 2012 Sometimes it is hard to wee . . . And the older you get, the harder it will get. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.