Advertisement
| 06.19.2008 at 07:36PM PDT, ID: 23501104 |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: |
-------------------------
Populating a list box
-------------------------
<?php
include_once("Settings.php"); //Path to Settings.php
$Query = "SELECT * FROM $DBTable";
$Result = @mysql_query($Query, $DBServer) or die(($DebugMode === true ? "MySQL Query Error:<br />" . mysql_error() : $MySQLQueryError));
$ListOptions = "";
while ($Row = @mysql_fetch_array($Result) or die(($DebugMode === true ? "MySQL Query Error:<br />" . mysql_error() : MySQLQueryError))) {
//The following line creates the <option></option> tags for the <select> list
$ListOptions .= "\t<option value='" . $Row["IDFieldHere"] . "'>" . $Row["ListValuesFieldHere"] . "</option>\n";
}
?>
<select name='MyList'>
<?php echo $ListOptions; ?>
</select>
-----------------
Settings.php
-----------------
<?php
$user = "threerob_3rob";
$password = "sfq6v7a45q9j";
$database = "threerob_threerobots";
$server = "localhost";
$table = "event";
$connection = mysql_connect( $server, $user, $password ) or die ("Connection to $server failed");
mysql_select_db($database, $connection);
$sql = "SELECT * FROM event";
$result = mysql_query($sql) or die("Sql Query Failed: " . mysql_error());
while ($row = mysql_fetch_array($result)) {
echo $row["Description"] . "\n";
}
?>
-----------------
Settings.php OLD FILE
-----------------
<?php
$DBName = "MyDatabase"; //Name of the MySQL Database
$DBTable = "MyTable"; //Name of your table
$DBUser = "MyUsername"; //MySQL Username
$DBPass = "MyPassword"; //MySQL Password
$DBServer = "localhost"; //Address of MySQL server (localhost if MySQL is on the same server as this file)
$DebugMode = false; //true displays detailed errors, false displays friendly messages
$MySQLConnectError = "Could not connect to database. Please try again later. Sorry for any inconvenience caused."; //MySQL connect error message (displayed only when DebugMode = false)
$MySQLQueryError = "There was a problem retrieving data from the database. Sorry for any inconvenience caused."; //MySQL query error message (displayed only when DebugMode = false)
/************************************
* Do NOT edit below, unless you know
* what your doing.
************************************/
$DBConn = @mysql_connect($DBServer, $DBUser, $DBPass) or die(($DebugMode === true ? "Could not connect to database.<br />MySQL Error:<br />\n" . mysql_error() : $MySQLConnectError));
@mysql_select_db($DBName, $DBServer) or die(($DebugMode === true ? "Could not connect to database.<br />MySQL Error:<br />\n" . mysql_error() : $MySQLConnectError));
?>
|
Advertisement