Dethman Posted July 28, 2008 Share Posted July 28, 2008 Ok This is the error: [27-Jul-2008 15:15:04] PHP Fatal error: Maximum execution time of 30 seconds exceeded in C:\apache2triad\htdocs\admin\db_connect.php on line 3 Ok this is the DB_CONNECT.php <?php session_start(); mysql_connect('localhost', 'root', '') or DIE("UNABLE TO CONNECT TO DATABASE! Please Contact the administrator"); mysql_select_db('chip') or DIE("UNABLE TO SELECT THE DATABASE! Please Contact the administrator"); ?> This is the Function: <?php // /// FUNCTION SYSTEM! // function getSysteminfo(){ $q="SELECT * FROM `system` WHERE `id`='1'"; $v=mysql_query($q) or die("SQL ERROR: <br>".mysql_error()); $r=mysql_fetch_array($v); return $r; } ?> This Is the Call: <?php $System=getSysteminfo(); die($System); ?> Ok when I take away the Die($System); It dosnt have an error but does not display the info when I call Like this: $System['name'] Quote Link to comment https://forums.phpfreaks.com/topic/117061-ok-i-went-to-die-this-var-and-i-got-an-error-in-my-db_connect/ Share on other sites More sharing options...
.josh Posted July 28, 2008 Share Posted July 28, 2008 well of course it's not displaying anything. You haven't echoed anything out. Quote Link to comment https://forums.phpfreaks.com/topic/117061-ok-i-went-to-die-this-var-and-i-got-an-error-in-my-db_connect/#findComment-602089 Share on other sites More sharing options...
trq Posted July 28, 2008 Share Posted July 28, 2008 Your getSysteminfo() doesn't return anything. Quote Link to comment https://forums.phpfreaks.com/topic/117061-ok-i-went-to-die-this-var-and-i-got-an-error-in-my-db_connect/#findComment-602090 Share on other sites More sharing options...
Dethman Posted July 28, 2008 Author Share Posted July 28, 2008 To Crayon: Ok I echo that little thing like this I was showing you what I put in the echo: <?echo($System['name']);?> To Thorpe: Duh But it should return stuff As I use the exact same code in one of my games! How would I get it to actually work and echo the stuff in the table system ??? Quote Link to comment https://forums.phpfreaks.com/topic/117061-ok-i-went-to-die-this-var-and-i-got-an-error-in-my-db_connect/#findComment-602095 Share on other sites More sharing options...
.josh Posted July 28, 2008 Share Posted July 28, 2008 You use the exact same code in one of your games, and your game works and yet this doesn't? Hmm, that's very interesting. Quote Link to comment https://forums.phpfreaks.com/topic/117061-ok-i-went-to-die-this-var-and-i-got-an-error-in-my-db_connect/#findComment-602098 Share on other sites More sharing options...
.josh Posted July 28, 2008 Share Posted July 28, 2008 Anyways, did you try return $r; ? Quote Link to comment https://forums.phpfreaks.com/topic/117061-ok-i-went-to-die-this-var-and-i-got-an-error-in-my-db_connect/#findComment-602100 Share on other sites More sharing options...
maxudaskin Posted July 28, 2008 Share Posted July 28, 2008 The game could have created the function getSysteminfo Quote Link to comment https://forums.phpfreaks.com/topic/117061-ok-i-went-to-die-this-var-and-i-got-an-error-in-my-db_connect/#findComment-602101 Share on other sites More sharing options...
trq Posted July 28, 2008 Share Posted July 28, 2008 How would I get it to actually work and echo the stuff in the table system <?php function getSysteminfo() { $q = "SELECT * FROM `system` WHERE `id`='1'"; if ($result = mysql_query($q)) { if (mysql_num_rows($result)) { return mysql_fetch_array($result); } } return false; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/117061-ok-i-went-to-die-this-var-and-i-got-an-error-in-my-db_connect/#findComment-602103 Share on other sites More sharing options...
Dethman Posted July 28, 2008 Author Share Posted July 28, 2008 Crayon Dont you see that, that return $r; is already in that function? Quote Link to comment https://forums.phpfreaks.com/topic/117061-ok-i-went-to-die-this-var-and-i-got-an-error-in-my-db_connect/#findComment-602104 Share on other sites More sharing options...
Dethman Posted July 28, 2008 Author Share Posted July 28, 2008 How would I use that function if it Returns False? Quote Link to comment https://forums.phpfreaks.com/topic/117061-ok-i-went-to-die-this-var-and-i-got-an-error-in-my-db_connect/#findComment-602105 Share on other sites More sharing options...
.josh Posted July 28, 2008 Share Posted July 28, 2008 Crayon Dont you see that, that return $r; is already in that function? Umm...grow up? Do you want help or not? I saw your original unedited code without the $r. Thorpe even commented on it. You went back and changed it after the fact. If it didn't work, then fine, just say it didn't work so we can figure out where the issue is; don't be all childish. Quote Link to comment https://forums.phpfreaks.com/topic/117061-ok-i-went-to-die-this-var-and-i-got-an-error-in-my-db_connect/#findComment-602106 Share on other sites More sharing options...
.josh Posted July 28, 2008 Share Posted July 28, 2008 How would I use that function if it Returns False? It returns false if nothing is returned from the query. Otherwise, it returns the fetched results. If you had bothered to actually look at the code you would see that. Quote Link to comment https://forums.phpfreaks.com/topic/117061-ok-i-went-to-die-this-var-and-i-got-an-error-in-my-db_connect/#findComment-602107 Share on other sites More sharing options...
Dethman Posted July 28, 2008 Author Share Posted July 28, 2008 How would I call the function and I am sorry for the Edit Quote Link to comment https://forums.phpfreaks.com/topic/117061-ok-i-went-to-die-this-var-and-i-got-an-error-in-my-db_connect/#findComment-602108 Share on other sites More sharing options...
trq Posted July 28, 2008 Share Posted July 28, 2008 How would I call the function and I am sorry for the Edit <?php $System = getSysteminfo(); echo $System['whatever']; ?> Quote Link to comment https://forums.phpfreaks.com/topic/117061-ok-i-went-to-die-this-var-and-i-got-an-error-in-my-db_connect/#findComment-602113 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.