otuatail Posted April 3, 2017 Share Posted April 3, 2017 functions.php function readconfig() { $sqlReadConfig = "SELECT * FROM whatadrama_config"; $qReadConfig = mysql_query($sqlReadConfig) or die ("E201-100A"); $rs = mysql_fetch_array($qReadConfig) or die ("E201-100B"); //echo $rs[0] . " - " . $rs[1] . " - " . $rs[2] . " - " . $rs[3]; // *** This works fine *** //exit; return $rs; } webpage.php <? $rs = readconfig(); echo $rs[0]; ?> I can read the contents of a table in my functions file but when I comment out the reading code and return $rs; I can't read it in the main web page. Link to comment Share on other sites More sharing options...
requinix Posted April 3, 2017 Share Posted April 3, 2017 Assuming all the obvious problems are just a result of how you made your post, How about using a full <?php open tag? Link to comment Share on other sites More sharing options...
otuatail Posted April 3, 2017 Author Share Posted April 3, 2017 Ok Thanks. I don't always use use the full <?php ?> and things have worked. It does work now. Sudenly realised. I normaly use <?php at the top of my pages. Left it out this time so it must have got confused. Link to comment Share on other sites More sharing options...
NigelRel3 Posted April 3, 2017 Share Posted April 3, 2017 You should also look into changing mysql_query to either mysqli or PDO. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.