Jump to content

Ok I Went to Die This Var and I got an Error In my DB_CONNECT


Dethman

Recommended Posts

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']

Link to comment
Share on other sites

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 ???

Link to comment
Share on other sites

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;
 }

?>

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.