How To Show The Number Of Queries Executed For A PHP/mysql Page?
I would like to do some benchmark on my site...
Could you tell me how to show the numbe rof queries executed for a PHP/mySQL generated page?
View Complete Forum Thread with Replies
Related Forum Messages:
Reduce The Number Of Queries Per Page
When I have 500-600 users online my server's load is very high and I noticed that MySQL eats a lot of resources. So, I am trying to reduce the number of queries per page. I have the following idea. When user is logged in, on each click php script connects to the database to check if this user has new instant messages. My idea is to store time in a cookie (let's say, 5 minutes) and then the script on each click will check just cookie and will connect to the db only 1 time in 5 minutes.
View Replies !
What User Are PHP Database Queries Executed As?
I have an installation of Apache that apparently includes PHP (out of the box Redhat 9.0). If I make database calls to Postgresql, as what user is that call going to be made? The user that Apache is running as? Can I specify the user that the call is to be made as?
View Replies !
Show Number Of Visits On Each Page...
How should i do when I want to show number of visitor on each page where each page is describing a user details like this: http://localhost/user.php?user=1 on this page it show details about user 1. And for user_52 I want to show how many visitors this user have had: http://localhost/user.php?user=52 it will show number of visits
View Replies !
PHP Page Get Executed Twice
I have a problem with a PHP page that seems to get executed twice. I am running PHP5 ISAPI on 2003 server. The script is a PHP page with a form. When the form is submitted one record have to be inserted in the database but when i look at the database after submitting the form there are two(!) records inserted so it looks like the script is executed twice. Can this be a proxy-setting or an ISA`server related subject?
View Replies !
PHP Path Shows On Web Page When Script Is Executed
So this is an aesthetic question, the code all works, thank goodness. The issue is that whenever I call/execute my php scripts, which all require the path as the first line, i.e., #!/usr/pubsw/bin/php ... and I want to know why that line shows up on the web browser?! (None of the other code shows, except for whatever other html things that are supposed to show). My "workaround" at the moment is to have <body text="FFFFFF"> which makes it white like the background, but there's gotta be a reason for this, right? :-)
View Replies !
Delimiting Timestamp Queries To Show Only Date, No Time
I can't find anything on google or even searching the forums that comes remotely close to being understandable by me. I have a MySQL timestamp(current timestamp) I'm using to date every entry. HOWEVER, I can't figure out how to get rid of the time portion and only display the date.
View Replies !
Mysql Executed Or Not
I ran this mysql statement: mysql> update phpbb_posts_text, phpbb_posts set phpbb_posts_text.post_id = phpbb_posts.x where phpbb_posts_text.post_id = phpbb_posts.post_id; But I got this error: ERROR 1062 (23000): Duplicate entry ��' for key 1 I just need to know if this statement made any PARTIAL changes to my database, but then stops abruptly when it finds an error. this in effect would make me have to recover my db from a backup.
View Replies !
Do Queries On XML Similar To The Way That You Do Queries On MYSQL And Then Use The Results.
I am fairly familiar with PHP and MYSQL and I know a little about XML. I would like to know if it is possible to do queries on XML similar to the way that you do queries on MYSQL and then use the results. An example of a simple PHP/MYSQL setup. <?php $user="username"; $host="sqlserver"; $password="password"; $database="database"; $connection = mysql_connect($host,$user,$password) or die ("Couldn't connect to the server"); $db = mysql_select_db($database,$connection) or die ("Couldn't connect to the server"); $query = "SELECT * FROM database WHERE(Criteria)"; $result = mysql_query($query) or die ("Couldn't execute query."); while ($row = mysql_fetch_array($result)) { extract($row); echo"Set of instructions to carry out for each row in the result"; } ?> The question is, is it possible to do similar things with PHP/XML? Lets say that I have an XML file located at a certain URL and I want to run a query on it and use the results. 1. Is it possible? 2. What is the easiest way to do it? 3. How would I translate the above code to work with XML? 4. Is ther resource on the web on how to structure the queries?
View Replies !
Displaying X Number Of MySQL Results Per Page
I'm writing a search on a MySQL DB, and everything so far has just gone swimmingly. I've got a "results per page" drop down box in my form, with a few different values. At the moment, I'm just using: while($myrow = mysql_fetch_array($result) to output results to screen. I'm not too sure how to go about it, but I did have two thoughts: 1) Suck the results into a multi-dimensional array, and pass the array to a display results script (not sure if you can pass arrays to other scripts??? 2) Display x number of results, then have the "Next" (or 2, 3... ) links call the search again, but displaying results x+1 - x+x. 1 sounds like too much trouble, and 2 sounds inefficient. Not too sure how else to go about it. Any info / thoughts you guys have would be much appreciated. On a side note, how do you look at a specific row in the result?
View Replies !
"Please Wait" Page While Php Runs Mysql Queries
Does anyone have any idea what I should google to create a "splash page" that tells the user to wait while a few mysql quieries are run through the php page? It takes anywhere from 5 to 20 seconds, and I don't need a progress meter, just a splash page so they do not go anywhere and the user doesn't think there is a problem with their browser or network connection.
View Replies !
Echo Number Of Sql Queries
i would like to debug my site because i think there's something wrong with the sql. Is there a way i can echo the amount of database connections (should be one but i think it connects more than ones), but more important: is there a way i can echo out the number of sql queries and sql execution time and all things like that. (you see them a lot at the bottom of pages, it then says : sql queries : xx sql run time: script execution time:.. (things like that).
View Replies !
Displaying Number Of Queries
You know when you come across sites that are made from phpnuke or e107 for example, and you see 'Render time: 0.9862 second(s). DB queries: 62.' at the bottom of the page, how do they do that?
View Replies !
Mysql Query Executed Many Times
I've the same query executed many times and sometimes it returns all results (117 in my case) and sometimes it returns nothing. THE QUERY DOESN'T CHANGE, nor the datas in the database. On my pc it's OK (always returns 117 results) even on phpmyadmin it returns the 117 records found. On my ISP, the result is always 0 results, even if it shows 117 results. Here is the query (I know, not so simple, but I took an existing database) (SELECT Code, t.name, m.Name, t.idb,t.ids, prt , F.t, puiss, B.t, dst, den from t INNER JOIN m ON t.idm = m.idm INNER JOIN mk ON m.idmk = mk.idmk INNER JOIN t as F ON t.idf = F.id INNER JOIN t as B on t.idb = B.id WHERE mk.id = 'A12D' AND (m.ID = 15) AND (200001 >= dst AND (den = '' or 199905 <= den)) AND F.l = 'b' AND B.l = 'b') UNION (SELECT st.code, st.name, COALESCE(m.Name, sm.Name), st.idb, st.ids, st.prt, F.t, st.puiss, B.t, stdst, stden FROM st LEFT JOIN sm ON st.idm = sm.idm LEFT JOIN m ON st.idm = m.idm LEFT JOIN smk ON sm.idsmk = smk.idsmk LEFT JOIN mk ON m.idmk = mk.idmk LEFT JOIN mk AS mk1 ON sm.idmk = mk1.idmk LEFT JOIN t as F ON st.idf = F.id LEFT JOIN t as B on st.idb = B.id WHERE (m.ID = 15 or st.ID = 15 or sm.ID = 15) AND ((stdst is null or ��-01-01' >= stdst) AND (sten is null or ?'[color=blue] >= sten))[/color] AND F.l = 'b' AND B.l = 'b')
View Replies !
Limiting Number Of Database Queries...
I'm a web developer/webmaster and do some limited database/ASP (VBscript) stuff and some SEO. One of my clients has a new competitor. Their store locator stops you after 5 zip code queries ("..only 4 queries per week or 8 queries per month allowed.."). They are obviously using PHP. My client wants me to do the same for our MS-Access/ASP (Dreamweaver MX 2004) store locator database, which now has no limitations on number of ZIP, City name or Phone Area searches. Code:
View Replies !
Show Number Of Times
What I am wanting to to is to have a database that has multiple values stored in it and be able to show the number of times a certain value is found in a specific column. For example A|B|C ------- 1|2|4 2|2|5 5|6|9 the number of times 9 is found in column C is 1.
View Replies !
How To Show Number Of Threads In Forums?
I am creating a forum and I am trying to show how many threads have been created in each forum. With my current code, it's giving me the total threads for ALL forums. On top of that, each forum is getting the same result. Code:
View Replies !
Show Number Of Records Held
I want to display the numbers of records shown in each County on my database. PHP Code: mysql_connect($host,$username,$password); mysql_select_db($database) or die( "Unable to select database"); $query="SELECT county 'Bedfordshire', 'Berkshire' FROM t_data"; $result=mysql_query($query); $num=mysql_num_rows($result); while ($row = mysql_fetch_array($result)) { $Bedfordshire = $row["Bedfordshire"]; $Berkshire = $row["Berkshire"]; } How dow I show the number of records on Bedfordshire, Berkshire etc. I am echo'ing $Bedfordshire which shows the data not the number of Bedfordshire records held.
View Replies !
Format A Number To Show A Date
I have a number in my database which I want to format as a date. The problem is I don't know how to do this. The number appears on my browser screen as 20010621 and I would like it to look like this 21/06/2001 or something similar. This is where I get my data form the database Code: echo '<td>' . $row['Order_Date'] . '</td>'.
View Replies !
If Value =1 Direct To Page Otherwise Show Data On Page
In the member account area there is a button saying (list) when the member clicks this they are redirected to add.php here i am wanting to check if a members account is limited, if it is direct them to a page saying you must pay your bill. if its not display the info on the page. in the database there is a field called limited which is tiny in if its not limited the value of the field would be 0 if it is limited the value would be 1.
View Replies !
Successive Queries Against A Web Page
I would like to make successive posts (queries) to a web page. To do this I use fsockopen() as many times as the number of posts. But I guess that this may be done via only one socket. Is this true? Or any other way of doing this shorter? Because it comes to me redundant to open as many sockets as queries.
View Replies !
Forcing Queries/php To Refresh Page
let's say I have a page listing records in a table... If I go somewhere else and later on reload this list page, it does NOT refresh the list (if more records were added to the table meantime). What should I do? Is there a way to force a refresh? If I turn off the cache, are people still going to be able to cache the graphics (i don't want to force a reload of every element, just the page itself)?
View Replies !
# Queries On Page/general Design
As a basic design question, I have a query with a function that searches on two variables. The two variables needed to process the query reside wherever the function is being called on the page, to give a Count of the rows returned. There will be roughly 700-800 of these on the page total. Right now there are only about 75 of these placed (function must be processed 75 times?). But since I see a delay in opening the page already, now debating on whether to allocate the functions into several queries only for the reason of processing time down the road for when all functions are called on the page. Generally, guess my question simmers down to this: do multiple queries on a single page process simultaneously and thus faster -- or one after the next, as it appears a single query would do for the 700-800 total? Functionally, the same single query could perform all Counts.
View Replies !
If Page = 'about' Show The About.html Page?
I wanted to do some kind of PHP script so that if the current page the viewer is trying to view is called index.php?page=about then it will use the php script to embed with an i-frame the about.html file into a cell in my web page's table. Basically, so that the whole page stays the same other than one cell of the table which is dynamic depending on the status of the index.php?page=whatever. Code:
View Replies !
Best Practice For Making Large Queries In A Page
I've been doing php for a while now was always run into the problem of creating messy queries in my php files. For example, sometimes I add a LEFT JOIN, sometimes I add a WHERE CLAUSE and sometimes there's a search on my page so I have to add the LIKE '%xxx%'. Basically, I want to have a organized method of generating queries. I think C# uses a mysql function like APPEND. Should I put all my query parameters in the SESSION variables? and then just append/delete from the session variables before generating the query? Eg. $_SESSION['tables'] $_SESSION[where_params] $_SESSION[like_params] $_SESSION[left_joins] Then before each query, I just explode the array and make my query? IS this the best solution? or is there already one out there?
View Replies !
Queries Causing Page To Load Slowly
I'm currently having trouble getting a looped query to display the results in as quick a time as possible. At the moment the query takes far to long...and that's if it executes at all. At the moment i have around 3000 movie titles in the DB. Can anyone suggest a way of populating the select box in a relatively quick manner? Here is the code: PHP Code:
View Replies !
Page Control - Next/previous Or Select Page Number
I'm looking for php script examples that will help me control page layout. Using a table with 12,000 records, would like to be able to display only 5 records per page with page controls at the bottom of the page. The bottom edge would have next/previous or an optional insert desired page number.
View Replies !
Show Some And More On Next Page
I'm stuck making my log for login sessions show only 50 per page. The reason I need this is because it will only display about 250 items before not updating/displaying anymore. If anyone has a link to a tutorial, that would be super- couldnt find one via google.
View Replies !
Show When The Page Has Been Last Modified
1. I have php script that will show when the page has been last modified. How do I link it on my home page. The link that I am using now does not work. Here is the link: <? include("updatepage.php"); ?> 2. I have a php forum. When I link it this way <a href="xxxxx/index.php"> it brings up the source code. When I link it this way <a href="xxxxxx/"> it brings up the dir. When I link it this way <a href="http://xxx/xxxxx/index.php"> it works. How do I get it to work with this linking <a href="xxxxxx/index.php">
View Replies !
Show 20 Results Per Page
i have created a database with some data in it and i want my page to read page and display the first 20 results and on the bottom to add numbers like [1] [2] [3] so the user can go to the next results.I figured that i can display the first 20 results by adding a counter on the while loop $num_rows = mysql_num_rows($result); $k=0;      while (($k<=20)&&($row = mysql_fetch_row($result))){ $k+=1; $i+=1;but i don't know how to display the numbers on the bottom.Here is my try <?php for($j=1;$j<=($num_rows/20);$j+=1){   echo "[".$j."]"; } ?> ...
View Replies !
Flash .swf Doesn't Show In PHP Page
I've recently put together a flash navigation for a 4 page site... three pages are HTML, the index page is PHP with a weblog. In all current Mac browsers, all four pages load fine. In Win IE 6 only the .shtml pages will load the flash--the .php page shows a big white box instead. If I include the index.php in the index.shtml file, the flash loads fine, but I'd like to know if there is some issue with PHP & flash that I should look out for... or is the issue with IE 6.
View Replies !
Show Image On Same Page
I echo a certain amount of images, these images are thumbnails. I want to be able to show the real enlarged image next to the thumbnail without having to reload the page. So what i'm thinking of is something like the onclick function in JS. I tried some stuff but still can't make it work. my code is something like this: for (i=0; i<count($test); i++){ echo "<a href="...."><img src="$test[$i]"></a>"; } tried putting a javascript function in there but wasn't successful. i basically need to pass just $i to another function and that function onclick() will produce the image.
View Replies !
Show Home Page On Log In
I want to have a homepage with a log in feature. But I want it to say 'You are not logged in" or "you are logged in" depending on whatever is the case. I know how to check db entries etc but should I have the php on the same page in order to position the welcome note ie: <?php echo "<p>Welcome $_SESSION(username), to my website</p>;?>
View Replies !
Show Page Depending On Request Url?
Is there any way to show a different page depending on the request url? I have a few domains that point to one IP address. What I want to do is if someone requests http://www.site1.co.uk they see site1.php or http://www.site2.co.uk they see site2.php etc all from the root directory? I do not have httpd.conf access Is this possible?
View Replies !
Show Error Message On Same Page
I have Index.php which contains the HTML form with a username and password field + submit button, action: is my check.php. Say for example the user only input's a username and miss out the password field; when he clicks the submit button. I want the same page to be refreshed with a error message appearing below the submit button saying "error, please fill all in". I can get this to display on another page. but want this to be on refereshed on the log-in page.
View Replies !
Show Page Break In Records
I've just started to learn php and sql, and I noticed that there are several php discussion groups here. Pardon me if this is the wrong group, and I hope my first question isn't too silly. :-) I'm building a website that will publish articles, so I have an article table which contains a heading field, an ingress field, and a body field which will hold the complete article. There are line shifts (or page breaks) in this field, but my display-page won't show them. How do I show the article with the page breaks?
View Replies !
MySQL 'SHOW TABLES' Doesn't Show Temporary Tables?
I have a function call which creates a temporary table in MySQL, and then a second function call which operates on that temporary table. I was hoping to do something like this in the second function call to ensure that the table was in fact actually created: if (mysql_num_rows(mysql_query("SHOW TABLES LIKE 'my temp table name'"))) // do something else //error However, apparently the MySQL SHOW TABLES statement doesn't show temporary tables. Is there another query that I can use to show temporary MySQL tables so I can do this check?
View Replies !
How To Sho Video Clip On Web Page Also A Live Show On Web
Indeed I am using php and Mysql. My licent want to 1. Show a video clippings on the web site. What I need to do ? Please elaborate a n example will be great thing. 2. He also want me to show live telecast of a seminar What arrangement I ned to do From hardware point of view as well as Software point of view.
View Replies !
Page Load Time Show Really High
im running PHP 5.2 on IIS 6 (Windows 2003 Server) and im getting a weird load time result when trying to display page load times on each page. e.g. Page generated in 1193387528.5501 seconds. this is my current code: <?php $time = microtime(); $time = explode(' ', $time); $time = $time[1] + $time[0]; $finish = $time; $total_time = round(($finish - $start), 4); echo '<p>Page generated in '.$total_time.' seconds.</p>'." "; ?> but i've tried 4 others which are all simular. Any idea as to why it's showing a false result as it's loading in unde 1 second (Dual Xeon 2.8 HT server and connecting over 100mb pipe (college campus)).
View Replies !
Get A Paragraph Of Text To Show On The Home Page Only
I am using a script that I purchased and downloaded. This script has a template folder and inside has header. php, and footer.php. The center content is populated from various other pages. How would I get a paragraph of text to show on the home page only, and no other pages in the script
View Replies !
|