mac007 Posted October 29, 2008 Share Posted October 29, 2008 Hello, all: I keep having these speed issues when I echo or select from my database; I am wandering if the fact that many of these pages I have that refer to a db sometimes reside deep within the directory levels, maybe 3,4, even 5 levels down the directory root, (these in turn might call-up include files where the db connection info is, and this include files may be in root directory themeselves)... was just wandering.. I did change the level on these pages and looks like it did help, but I didnt think that the devel of depth where these pages were on mattered much, figuring that if there was any slowness, it would be so infinitesimal to php, that it really would be unnoticeable to the eye... Any other ideas why SELECTS/UPDATE , etc, with a database would be greatly hampered in speed? thanks! Link to comment https://forums.phpfreaks.com/topic/130587-database-records-come-up-very-slow-could-it-be-cause-page-is-deep-in-director/ Share on other sites More sharing options...
FVxSF Posted October 29, 2008 Share Posted October 29, 2008 If you're slow to echo from a DB it's probably the query. What's your query code? Link to comment https://forums.phpfreaks.com/topic/130587-database-records-come-up-very-slow-could-it-be-cause-page-is-deep-in-director/#findComment-677520 Share on other sites More sharing options...
phporcaffeine Posted October 29, 2008 Share Posted October 29, 2008 Has it always been slow or just recently started? Link to comment https://forums.phpfreaks.com/topic/130587-database-records-come-up-very-slow-could-it-be-cause-page-is-deep-in-director/#findComment-677534 Share on other sites More sharing options...
mac007 Posted October 29, 2008 Author Share Posted October 29, 2008 well, I just got a reply from my hosting company, they said "they have moved my database to a better performing server and should see increased performance".. hmm.. let's see if does make a difference...! as for the queries, even somewhat simple code like this (could the code be more efficiently put togehter?) i am pretty much a newbie at php: <CODE> <?php // connection info $host = 'hostname'; $user = 'user'; $password = 'pw'; $database = 'database_name'; $con = mysql_pconnect($host,$user,$password) or die('No Connection Found'); mysql_select_db($database,$con) or die('No Database Found'); $id = $_GET['id']; $delete = $_POST['delete']; $submit = $_POST['submit']; $id_update = $_POST['recordID']; $title = $_POST['title']; $body = $_POST['body']; if (isset($submit)){ mysql_query("UPDATE blog SET blog_title = '$title', blog_body = '$body' WHERE blog_id = '$id_update'"); echo "<font color='red'>Record Updated!</font>"; } if (isset($delete)) { mysql_query("DELETE from blog WHERE blog_id = '$id_update'") or die ('no record exists'); echo "<font color='red'>Record Deleted!</font>"; } if(isset($id)) { $result = mysql_query("SELECT * from blog WHERE blog_id = $id"); $row = mysql_fetch_array($result); } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>My Blog</title> <link href="styles.css" rel="stylesheet" type="text/css" /> </head> <body> <h1> BLOG ADMINISTRATION</h1> <?php // NOTES: // 1) make sure html entities function or some similar function validates/filters special charaacters present in form input-fields into proper html equivalents ?> <form id="form1" name="form1" method="POST" action=""> <p> Record #: <?php echo $row['blog_id']; ?></p> <p>post title: <input name="title" type="text" id="title" value="<?php echo htmlentities($row['blog_title'],ENT_QUOTES);?>"/> </p> <p><br /> post body:<br /> <textarea name="body" cols="50" rows="10" id="body"><?php echo htmlentities($row['blog_body'],ENT_QUOTES);?></textarea> </p> <p> <input name="recordID" type="hidden" id="recordID" value="<?php echo $row['blog_id'];?>" /> <input type="submit" name="submit" value="submit" /> <input name="delete" type="submit" id="delete" value="delete" /> </p> </form> <?php $result = mysql_query("SELECT * from blog ORDER BY blog_id DESC"); while($row = mysql_fetch_array($result)){ echo "<a href='?id=" . $row['blog_id'] . "'>". $row['blog_id']. "</a>" ." - ". $row['blog_title'] . "<br>"; } ?> </body> </html> <?php mysql_close($con); ?> </CODE> Link to comment https://forums.phpfreaks.com/topic/130587-database-records-come-up-very-slow-could-it-be-cause-page-is-deep-in-director/#findComment-677556 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.