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. Quote Link to comment https://forums.phpfreaks.com/topic/303614-return-a-recordset/ 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? Quote Link to comment https://forums.phpfreaks.com/topic/303614-return-a-recordset/#findComment-1544997 Share on other sites More sharing options...
otuatail Posted April 3, 2017 Author Share Posted April 3, 2017 (edited) 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. Edited April 3, 2017 by otuatail Quote Link to comment https://forums.phpfreaks.com/topic/303614-return-a-recordset/#findComment-1544998 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. Quote Link to comment https://forums.phpfreaks.com/topic/303614-return-a-recordset/#findComment-1545001 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.