Imtehbegginer Posted April 1, 2007 Share Posted April 1, 2007 <?php session_start(); include('inc/rosecms.php'); $rosecms_config = mysql_query("SELECT * FROM rosecms_config"); $rosecms_servers = mysql_query("SELECT * FROM rosecms_servers"); $rosecms = mysql_fetch_array($rosecms_config); $servers = mysql_fetch_array($rosecms_servers); ?> This: <?php echo $rosecms['logadmincp']; ?> Prints out NOTHING. This: <?php echo $servers['name']; ?> Does echo the right info. Any ideas? Quote Link to comment Share on other sites More sharing options...
yzerman Posted April 1, 2007 Share Posted April 1, 2007 try this: <?php session_start(); include('inc/rosecms.php'); $rosecms_config = mysql_query("SELECT * FROM rosecms_config"); $rosecms_servers = mysql_query("SELECT * FROM rosecms_servers"); $rosecms = mysql_fetch_array($rosecms_config); $servers = mysql_fetch_array($rosecms_servers); if (!$rosecms) { echo 'There was an error in your mysql query. The error returned was' . mysql_error($rosecms_config); } else { echo $rosecms; } ?> Quote Link to comment Share on other sites More sharing options...
Imtehbegginer Posted April 1, 2007 Author Share Posted April 1, 2007 That echos "Array" but it wont echo the data in the table. echo $rosecms['allowreg'] should echo YES. It doesnt. Quote Link to comment Share on other sites More sharing options...
yzerman Posted April 1, 2007 Share Posted April 1, 2007 The name in $rosecms['name'] should be exactly the field name. try this, and see if the names returned are the ones you are using: <?php session_start(); include('inc/rosecms.php'); $rosecms_config = mysql_query("SELECT * FROM rosecms_config"); $rosecms_servers = mysql_query("SELECT * FROM rosecms_servers"); $rosecms = mysql_fetch_array($rosecms_config); $servers = mysql_fetch_array($rosecms_servers); if (!$rosecms) { echo 'There was an error in your mysql query. The error returned was' . mysql_error($rosecms_config); } else { print_r($rosecms); } ?> Quote Link to comment Share on other sites More sharing options...
Imtehbegginer Posted April 1, 2007 Author Share Posted April 1, 2007 Array ( [0] => md5reg [config] => md5reg [1] => 1246.8.. [value] => 1246.8.. ) That's what I get with that. Quote Link to comment Share on other sites More sharing options...
yzerman Posted April 1, 2007 Share Posted April 1, 2007 so are the names returned the ones you are using? Quote Link to comment Share on other sites More sharing options...
Imtehbegginer Posted April 1, 2007 Author Share Posted April 1, 2007 With my original code, the $servers['name'] was working fine. The $rosecms[]; wont. Quote Link to comment Share on other sites More sharing options...
yzerman Posted April 1, 2007 Share Posted April 1, 2007 so are the names returned the ones you are using? What I am asking is: In the resulting array that was printed out: Array (* => md5reg [config] => md5reg [1] => 1246.8.. [value] => 1246.8.. [2]) Basically, $rosecms['config'] would echo md5reg, and so would $rosecms[1] My question to you is, you tried using $rosecms['logadmincp'] Does this value show up anywhere in the array that is printed out? Quote Link to comment Share on other sites More sharing options...
Imtehbegginer Posted April 1, 2007 Author Share Posted April 1, 2007 No... it doesnt. Quote Link to comment Share on other sites More sharing options...
yzerman Posted April 1, 2007 Share Posted April 1, 2007 Then thats why it will not return a value. Quote Link to comment Share on other sites More sharing options...
spfoonnewb Posted April 1, 2007 Share Posted April 1, 2007 See what this says: <?php $rosecms_config = mysql_query("SELECT logadmincp FROM rosecms_config") or die(mysql_error()); $rosecms = mysql_fetch_array($rosecms_config); echo $rosecms['logadmincp']; ?> Quote Link to comment Share on other sites More sharing options...
Imtehbegginer Posted April 1, 2007 Author Share Posted April 1, 2007 Unknown column 'logadmincp' in 'field list' - There's only 2 column's in "rosecms_config".... "config" and "value". Quote Link to comment Share on other sites More sharing options...
spfoonnewb Posted April 1, 2007 Share Posted April 1, 2007 So which one has the value you want? Quote Link to comment Share on other sites More sharing options...
yzerman Posted April 1, 2007 Share Posted April 1, 2007 Imthebeginner, The mysql_fetch_array function will return an array of the results, both numbered, and by the table field names they are pulled from if not specified. If the table does not contain a field named logadmincp, then that field will not be a valid mysql result, meaning you need to find out where your data is stored, and what the field name is that you want to echo. 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.