<img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/wallbash.gif" style="vertical-align:middle" emoid=":wallbash:" border="0" alt="wallbash.gif" /> I am having trouble with a header.inc.php file. It requires that all variables (ie. databasename, user, passwd, host) are entered into an array. when I simply assign strings and connect to database,, it works. but know in an array format it continues to say that <br /><br />Error: You must set your correct database access info in `inc/header.inc.php`. <br />but I am pretty sure the syntax is right. Unless synta is different for an array. this is what I have: <br /><?php<br /><br /><br /><br /><br /><br />// Bold is changed<br /><br />//just to simplify N= name<br /><br />$db = array('host'=>'localhost',<br /><br />'user'=>"<b>cpnelN</b>_<b>userN</b>",<br /><br />'pass'=>"<b>XXXXX</b>",<br /><br />'name'=>"<b>cpanelN</b>_<b>databaseN</b>db");<br /><br />$db['prefix'] = 'dotsilver_';<br /><br />$mysql = new MySql( $db );<br /><br />$mysql -> connect();<br /><br />$_conf = $mysql -> get_conf_array();<br /><br />$mysql -> close();<br /><br />if( $_SERVER['QUERY_STRING'] != 'first')<br />foreach( $_conf as $value )<br />{<br />if( !$value ) Header('Location: configs.php?first');<br />}<br /><br />$_dir = array<br />(<br />'0'=> $_conf['home_dir'],<br />'inc'=> $_conf['home_dir'].'inc/',<br />'smarty'=> $_conf['home_dir'].'smarty/',<br />'layouts'=> $_conf['home_dir'].'layouts/',<br />'langs' => $_conf['home_dir'].'langs/',<br />);<br /><br />$_site = array(<br />'pid'=> $_conf['site_ID'],<br />'layout'=> $_conf['layout_name'],<br />'theme'=> $_conf['color_theme'],<br />'app_name' => 'dating',<br />'bizname'=> $_conf['bizname'],<br />'brand'=> $_conf['brand'],<br />'mail_support'=> $_conf['mail_support'],<br />'mail_links'=> $_conf['mail_links'],<br />'mail_info'=> $_conf['mail_info'],<br />'mail_ads'=> $_conf['mail_ads'],<br />'age_start'=> 18,<br />'age_end'=> 75,<br />'online_time'=> 10,<br />);<br /><br />$_sock = array(<br />'domain'=> 'dating-remote.dotsilver.com',<br />'domain_img'=> 'dating-img.dotsilver.com',<br />);<br /><br />$_url = array(<br />'site_url'=> $_conf['site_url'],<br />'site'=> $_conf['site_url'],<br />'_remote_lc_img'=> "http://{$_sock['domain_img']}/photo.php",<br />'_remote_lc_img_up'=> "http://{$_sock['domain_img']}/photo_up.php",<br />'flash_server'=> 'rtmp://dotsilver.com/',<br />'im_xml' => 'http://dating-im.dotsilver.com/',<br />'anti_scam' => 'http://www.dotsilver.com/antiscam/public/dating/',<br />'faq_scammers'=>'http://www.dotsilver.com/antiscam/'<br />);<br /><br />$_url['js']= $_url['site'].'inc/js/';<br />$_url['member']= $_url['site'].'member/';<br />$_url['layouts']= $_url['site'].'layouts/';<br />$_url['tour']= $_url['site'].'tour/';<br />$_url['img']= $_url['layouts'].$_site['layout'].'/themes/'.$_site['theme'].'/img/';<br />$_url['image_upload'] = "{$_url['site_url']}member/photos.php";<br /><br />$_langs = array(<br />'English',<br />);<br /><br />?><!--content-->
The array format is correct but I would have to see the actual script that connects to be able to help more. Possibly a file called sql.class.php<!--content-->
Welcome to the forums jmack772003.<!--content-->
Welcome to the forums jmack772003<!--content-->
Welcome to the forum, jmack772003. <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/smile.gif" style="vertical-align:middle" emoid="" border="0" alt="smile.gif" /><!--content-->
Welcome to the forums, jmack772003! <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/thumbup1.gif" style="vertical-align:middle" emoid=":thumbup1:" border="0" alt="thumbup1.gif" /><!--content-->
Welcome to the forums, jmack772003 <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/biggrin.gif" style="vertical-align:middle" emoid="" border="0" alt="biggrin.gif" /><!--content-->
<img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/sick.gif" style="vertical-align:middle" emoid=":sick:" border="0" alt="sick.gif" /> Carbonize, I appreciate you takin a look at this for me. here is that file, it is called db_funcs.class.php. I am know expert but it seems like it is calling the ($db)array correctly......do you think I could have done something wrong in the input of connection strings(in the header)? maybe 'localhost' doesn't work in an array? I don't know. but here it is....and thanks again:<br /><br /><br /><br />class MySql<br />{<br /><br />function MySql( $db )<br />{<br />$this->host = $db['host'];<br /> $this->user = $db['user'];<br /> $this->pass = $db['pass'];<br /> $this->name = $db['name'];<br /> $this->prefix = $db['prefix'];<br />}<br /><br />function connect()<br />{<br />$host = $this->host;<br /> $user = $this->user;<br /> $pass = $this->pass;<br /> $name = $this->name;<br /><br />@mysql_connect($host, $user, $pass)or die( '<code><b>Error:</b> You must set your correct database access info in `<b>inc/header.inc.php</b>`.' );<br /><br />mysql_select_db($name)or die( '<code><b>Error:</b> You must set your correct database access info in `<b>inc/header.inc.php</b>`.' );<br />}<br /><br />function query( $query )<br />{<br />return mysql_query($query);<br />}<br /><br />function fetch_array( $result, $type = MYSQL_ASSOC )<br />{<br />return mysql_fetch_array( $result, $type );<br />}<br /><br />function close()<br />{<br />mysql_close();<br />}<br /><br />function get_conf_array()<br />{<br /><br />$prefix = $this->prefix;<br /><br />$result = $this->query( "SELECT name, value FROM `".$prefix."config`" );<br /><br /> if( $result )<br /> {<br /><br /> while( $row = $this -> fetch_array( $result ) )<br /> {<br />$_conf[$row['name']] = $row['value'];<br /> }<br /><br /> }<br /> elseif( $_SERVER['QUERY_STRING'] != 'first' && $_SERVER['QUERY_STRING'] != 'action=save')<br /> {<br /> Header( 'Location: configs.php?first' );<br />exit;<br /> };<br /><br /> return $_conf;<br />}<br /><br />}<br /><br />?><!--content-->
Your array is correct but it is saying some of the information you supplied is wrong.<!--content-->
<img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/blink.gif" style="vertical-align:middle" emoid=":blink:" border="0" alt="blink.gif" /> got it ...you were correct...on array for database I added the "db" to the end . it was rejecting it.....of course now I get a new message from configs file.....what does <br /><br />Warning: Cannot modify header information - headers already sent by (output started at /home/alcfuo/public_html/DRV/inc/header.inc.php:97) in /home/alcfuo/public_html/DRV/configs.php on line 348 mean?<br /><br /><br />sorry...it is supposed to call file from my directory to install...if that help.<!--content-->
That means that the script needs to be the very first thing on the page before any HTML or any other scripts.<!--content-->
Look for any lines that have a blank space before the code is run<br />or before going into php, thats the normal cause.<!--content-->
The array format is correct but I would have to see the actual script that connects to be able to help more. Possibly a file called sql.class.php<!--content-->
Welcome to the forums jmack772003.<!--content-->
Welcome to the forums jmack772003<!--content-->
Welcome to the forum, jmack772003. <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/smile.gif" style="vertical-align:middle" emoid="" border="0" alt="smile.gif" /><!--content-->
Welcome to the forums, jmack772003! <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/thumbup1.gif" style="vertical-align:middle" emoid=":thumbup1:" border="0" alt="thumbup1.gif" /><!--content-->
Welcome to the forums, jmack772003 <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/biggrin.gif" style="vertical-align:middle" emoid="" border="0" alt="biggrin.gif" /><!--content-->
<img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/sick.gif" style="vertical-align:middle" emoid=":sick:" border="0" alt="sick.gif" /> Carbonize, I appreciate you takin a look at this for me. here is that file, it is called db_funcs.class.php. I am know expert but it seems like it is calling the ($db)array correctly......do you think I could have done something wrong in the input of connection strings(in the header)? maybe 'localhost' doesn't work in an array? I don't know. but here it is....and thanks again:<br /><br /><br /><br />class MySql<br />{<br /><br />function MySql( $db )<br />{<br />$this->host = $db['host'];<br /> $this->user = $db['user'];<br /> $this->pass = $db['pass'];<br /> $this->name = $db['name'];<br /> $this->prefix = $db['prefix'];<br />}<br /><br />function connect()<br />{<br />$host = $this->host;<br /> $user = $this->user;<br /> $pass = $this->pass;<br /> $name = $this->name;<br /><br />@mysql_connect($host, $user, $pass)or die( '<code><b>Error:</b> You must set your correct database access info in `<b>inc/header.inc.php</b>`.' );<br /><br />mysql_select_db($name)or die( '<code><b>Error:</b> You must set your correct database access info in `<b>inc/header.inc.php</b>`.' );<br />}<br /><br />function query( $query )<br />{<br />return mysql_query($query);<br />}<br /><br />function fetch_array( $result, $type = MYSQL_ASSOC )<br />{<br />return mysql_fetch_array( $result, $type );<br />}<br /><br />function close()<br />{<br />mysql_close();<br />}<br /><br />function get_conf_array()<br />{<br /><br />$prefix = $this->prefix;<br /><br />$result = $this->query( "SELECT name, value FROM `".$prefix."config`" );<br /><br /> if( $result )<br /> {<br /><br /> while( $row = $this -> fetch_array( $result ) )<br /> {<br />$_conf[$row['name']] = $row['value'];<br /> }<br /><br /> }<br /> elseif( $_SERVER['QUERY_STRING'] != 'first' && $_SERVER['QUERY_STRING'] != 'action=save')<br /> {<br /> Header( 'Location: configs.php?first' );<br />exit;<br /> };<br /><br /> return $_conf;<br />}<br /><br />}<br /><br />?><!--content-->
Your array is correct but it is saying some of the information you supplied is wrong.<!--content-->
<img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/blink.gif" style="vertical-align:middle" emoid=":blink:" border="0" alt="blink.gif" /> got it ...you were correct...on array for database I added the "db" to the end . it was rejecting it.....of course now I get a new message from configs file.....what does <br /><br />Warning: Cannot modify header information - headers already sent by (output started at /home/alcfuo/public_html/DRV/inc/header.inc.php:97) in /home/alcfuo/public_html/DRV/configs.php on line 348 mean?<br /><br /><br />sorry...it is supposed to call file from my directory to install...if that help.<!--content-->
That means that the script needs to be the very first thing on the page before any HTML or any other scripts.<!--content-->
Look for any lines that have a blank space before the code is run<br />or before going into php, thats the normal cause.<!--content-->