I read http://www.phphelp.com/article/article.php?art=46 that page, but can’t figure out what the heck is going on, it gave me this error.
“Warning: mysql_connect() [function.mysql-connect]: Unknown MySQL server host ‘DB_SERVER’ (11001) in C:Custom Programswampwwwphp_sandboxdbconnection.php on line 4
Sorry gangsta, the database connection failed: Unknown MySQL server host ‘DB_SERVER’ (11001)”
but dbconnection.php works in my other pages. anyways, in the code from that article, what do i change?
my database name is widget_corp and it connects through dbconnection.php, and in dbconstants.php are my username and password to connect to the database etc.
I have a table named subjects. Inside the table subjects i have 4 rows named ID MENU_NAME POSITION and VISIBLE
what do I replace with what in that articles code?
here’s the article code: [code]<?php
// load configuration
require(‘note-inf.php’);
// connect to db
require('db.php');
$sql = "SELECT item_name FROM items;";
$result = mysql_db_query($db_name,$sql);
if (!$result || mysql_num_rows($result) < 1) {
print mysql_error() . ' ERROR - SELECT note query failed! ';
}
// get result into array
$col=0;
$rows=mysql_num_rows($result);
for ($i=0; $i<$rows; $i++) {
$arr[$i]=mysql_result($result,$i,$col);
}
$i=0;
// break array over rows
print ‘
?>
[/code]