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

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

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

?>

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.

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.