nbarone Posted April 9, 2009 Share Posted April 9, 2009 <select name="viewGroup"> <?php $query = "SELECT * FROM sg09_groups WHERE group_display=1"; $result = mysql_result($query) or die (mysql_error()); while($row = mysql_fetch_array($result)){ echo "<option value=\"".$row['group_id']."\">".$row['group_name']."</option>"; } ?> </select> this code is dying, but not returning a mysql_error() ..... if I do.... $result = mysql_result($query) or die (mysql_error()."test"); it will return "test" Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted April 9, 2009 Share Posted April 9, 2009 Add the following two lines immediately after your first opening <?php tag - ini_set ("display_errors", "1"); error_reporting(E_ALL); Edit: And the posted code does not have a mysql_query() statement in it, which the error you will get by adding the above two lines will point out. You should be learning php, developing php code, and debugging php code on a system where error_reporting is set to E_ALL and display_errors is set to ON in your php.ini. Quote Link to comment Share on other sites More sharing options...
Maq Posted April 9, 2009 Share Posted April 9, 2009 It's supposed to be this: $result = mysql_query($query) or die (mysql_error()); Quote Link to comment Share on other sites More sharing options...
nbarone Posted April 9, 2009 Author Share Posted April 9, 2009 It's supposed to be this: $result = mysql_query($query) or die (mysql_error()); thanks, it's always the stupid little mistakes.. Quote Link to comment Share on other sites More sharing options...
Maq Posted April 9, 2009 Share Posted April 9, 2009 With error reporting turned on, like PFMaBiSmAd mentioned, this could have been easily detected. I do agree, it is always the little things... Mark as [sOLVED] please, thanks! Quote Link to comment Share on other sites More sharing options...
nbarone Posted April 9, 2009 Author Share Posted April 9, 2009 With error reporting turned on, like PFMaBiSmAd mentioned, this could have been easily detected. I do agree, it is always the little things... Mark as [sOLVED] please, thanks! I agree with the error reporting comment, however I am not the system admin and it is globally turned off. The onyl way I can access errors is to remote directly to the webserver. After doing that I must open the PHP file in cmd prompt. Quote Link to comment Share on other sites More sharing options...
Maq Posted April 9, 2009 Share Posted April 9, 2009 I agree with the error reporting comment, however I am not the system admin and it is globally turned off. The onyl way I can access errors is to remote directly to the webserver. After doing that I must open the PHP file in cmd prompt. No, you can temporarily turn them on with these lines of code: ini_set ("display_errors", "1"); error_reporting(E_ALL); Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted April 9, 2009 Share Posted April 9, 2009 You should be learning php, developing php code, and debugging php code on a local PC, where you would have access to the master php.ini. You can also set those two settings in a .htaccess file (when php is running as an Apache module, you must use the numeric equivalent of E_ALL), in a local php.ini (when php is running as a CGI application), or in your script (using the two lines of code that was posted) but this last option won't show fatal parse errors. Quote Link to comment Share on other sites More sharing options...
nbarone Posted April 9, 2009 Author Share Posted April 9, 2009 Thank you both, you have been a great help! 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.