Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    PHP


SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





Updated SQL Statement Returns No Records


I am writing a forum style log using MySQL as my databse

I have written the following query which worked successfully:

[SQL]
SELECT a.buildnumber, a.entered_by, a.date, b.Description as primdesc, c.Description as secdesc, a.notes, a.resolved as status FROM tbl_fault_log as a, tbl_primary_fault as b, tbl_secondary_fault as c where (a.primary_fault_id = b.id) and (a.secondary_fault_id = c.id) ORDER BY a.id ASC;
[/sql]

the table tbl_fault_log has a field history_id which links to tbl_history where all other history records for each record in tbl_fault_log are kept.

I want to amend the above query to include a count of history records in tbl_history for each record in tbl_fault_log. Code:




View Complete Forum Thread with Replies

Related Forum Messages:
Function That Returns Date Of File Last Updated
Is there a PHP function that can reference a file and return the date that the file was last updated?

View Replies !
Limit Record Returns And Next Records
I have my script limiting the number of records returned from a search to 10...

then I provide a link to another php page adding 10 to the offset to return the next 10 records...

however, the next 10 records that are being returned are not of the same query that the person searched for... the 10 records that are returned are starting from the 10th record in the entire dataset...

any ideas on how to bring up the next 10 records from what was already searched for?

View Replies !
Returns The Records In Primary Key Order.
I have a table containing customers which has a primary key on a field called "customerid".

I have the following query:

SELECT DISTINCTROW priority, customerid
FROM tblcustomers WHERE customerid IN (10153,609,156,663,10128)

The query works but always returns the records in primary key order. I want the order in the order specified using the IN keyword as above. Is this possible with MySQL?

View Replies !
If Statement Always Returns True
I have a script that inserts selected variables into a database. That works fine, but I don't want the same row to appear twice in the same table. I went ahead and wrote an If Statement, but for some reason, it always returns true, even if there are NO rows in the table. PHP Code:

View Replies !
Query Returns All Records In Php5 (but Not Php4)
I am moving all my PHP sites form a server running PHP 4 to a new server running PHP 5 Having trouble with a URL passed variable or the query syntax.
URL calls a PHP page and passes a variable: Code:

View Replies !
Image Submit Button Always Returns False In If Statement
I'm using an image as a submit button but when i click on the image my if statement doesn't seem to be true, it always returns as false. Here is my code:

View Replies !
MySQL UNION: Only The First Select Statement Returns A Result.
I am attempting to join multiple select statements into a single query.
However, I am not able to extract the result of any of the UNIONED selects.











$query1 = mysql_query ("
(
SELECT SUM(deposits) AS total_deposits
FROM table1
)

UNION ALL
(
SELECT SUM(withdrawals) AS total_withdrawals
        FROM table1
)
")
or die (mysql_error());

$result1 = mysql_fetch_array($query1);
extract($result1);




When I echo the results of the second select statement I get nothing.


echo  $total_withdrawals;

View Replies !
Do A DELETE Statement To Remove Any Records That Don`t Match.
I`m just trying to figure out the best method to delete my records and wondered if it was possible to do a DELETE statement to remove any records that don`t match. Here is my code so far:

$Query="select blah its huge:-)";
$RESULT=mysql_query($Query);
$my_rows=mysql_num_rows($RESULT);

for ($a=0; $a<$my_rows; $a++){
mysql_data_seek($RESULT, $a);
$Array = mysql_fetch_array($RESULT);
printf("%s<BR>", $Array['Email']);}

My Query returns Matched Records, what I would like to achieve is deletion of the records that didn`t match, would it be possible to do that under the printf statement. So delete all the records in the table that don`t match up to $Array['Email']??

View Replies !
Delete Records And Files In 1 Statement At Same Time?
How can i delete records and files in 1 statement at same time?

View Replies !
Displaying Priorty Records And Normal Records In The One Dataset.
I have a page which displays the records from the database and uses paging to display the records in groupes of 10 per page.

I now want to be able to show results depending on the database field (display) in the database (can be set to either "full" or "limited"). If the record and the field display is equal to "full" i want to then display this record at the top of the record set and display all the fields.

If the record is equal to "limited" i want to display different results and they must show after all the records which are equal to "full". I can't output two different recordsets as i use paging and only want to show 10 records per page. Code:

View Replies !
Displaying Multiple Records And Want To Be Able To Update These Records With Different Values.
I am creating a page where I am displaying multiple records and want to be able to update these records with different values.

View Replies !
DELETE RECORDS - Database Adding New Records
iv got the database adding new records, and now I want it to display all of the records that are there buy name and id number, then i want u to be able to type in the id number of the customer u wish to delete and it shoudl delete it, sounds good buts its not actually deleting the record. it says it does, but its not doing it. Code:

View Replies !
Problems With The Listing Of Records, Editing Of Records
I'm having problems with the listing of records, editing of records, and deleting of records. I'm not sure what I'm doing wrong.

The listing script is calling the add entry script. So I add the record, the database is updated, and nothing else happens. I don't get a list of records from that table.

When I did SQL programming off the mainframe, you did a simple select statement. I'm not sure why the PHP list script is calling the add entry script. Code:

View Replies !
Last Updated
I want to write a simple script where I can specify a bunch of URLs and it posts when each page was last updated. I'm not sure which function to use though, i can't use something like filemtime() because that only works for the current page. any help would be appreciated.

View Replies !
Url Updated
What is the best way to know if a website was updated using php?

I tried maybe using the last modified date
but it seems that some sites dont have that
info.

View Replies !
Sessions Not Getting Updated
I posted on this matter earlier with the subject line "Trouble with
sessions," but someone else started a different thread with the same
subject line that arrived before my post, so I'm changing my subject
line in order to avoid confusion.

I was asked to provide a code example for analysis, so here it is,
along with a
a description of what the problem is.

I'm working with sessions and the values for HTML text fields
(input="text") aren't getting updated after the first time I submit
the form. If I shut down my browser and start anew, I can write to the
session just once, as before. On the other hand, radio buttons -- used
with the Sticky Multivalued Parameters script on pages 170-171 of
O'Reilly's "Programming PHP" -- are updated every time. Here's an
example of my code. Many thanks to anyone who can make sense of what's
going on here.

<html>
<head>
<title>First Form Sessions</title>
</head>
<body>
<form action="form_processor.php4" method="POST">
First Name: <input type="text" name="firstName" value="<?php echo
$firstName ?>" /><br />
<input type="submit" />
</form>

</body>
</html>

// Next, the form processing script which is on another page.
// In my more complex script of actual use the form is only
// included if it doesn't pass validation.

<?php
session_start();
session_register("firstName");
?>

<html>
<head>
<title>Form Processor Sessions</title>
</head>
<body>

<?php
echo "$firstName<br />";
include 'first_form.php4'
?>

</body>
</html>

View Replies !
Database Getting Updated Twice
Another question for you.

I have a script that reads in a row from my db into an image object
which i defined. It then takes that image and generates a thumbnail by
using an output buffer and writes the thumbnail to a new entry in the
database. Finally it prints the new image to the screen via this
method:

header("Content-type: ".$image->GetFileType());
header("Content-length: ".$this->GetFileSize());
echo $this->GetImageContent();

where GetImageContent returns the binary data contained in the image.

This all seems to work, but when it hits the first header line
header("Content-type: ".$image->GetFileType());

it adds a second entry into the database. Basically im ending up with 2
identical records.

Ive been trying to figure out how to work around this, and the only
thing i could think of was that because im calling to header the script
is getting executed twice. No where in my print function so i have a
call to save so my question i suppose is, is it possible for a script
to execute a second time because of a call to header?

View Replies !
Page Last Updated
I have web pages that have at the bottom Page Last Updated 4th October 2007. Currently this has to be done by hand, but it would be better if the date stamp could be read and placed there automaticaly.

View Replies !
UPDATED Vs INSERTed
I have a MySQL database, and a php script that does some inserting or updating of data for that DB. Ill be light on the details and nitty gritty so as not to confuse anyone but you will fully understand what I need after reading this The database has information like ID, SYSNAME, PROGRESS. ID is unique, but so isnt SYSNAME.

I have a script that pulls a number (PROGRESS) from flat files on the server, and I want to put this info in the DB. problem is, this script runs every 2 mins (cronjob). I want to UPDATE the computer in the database if the information (PROGRESS) has changed, but there will be some instances where a new flat file (or rather, a new computer added) is added to this setup and the INSERT command for a new computer/row of data will need to be made. So this is my theory on how to do this.

- Take the flat file info throw it in an array (no problem, already done).
- Use SELECT to find out the current rows in the database.
- Compare the array from the database (results) to the array from the flat file stuff
- Write an if else statement for an INSERT or UPDATE.

View Replies !
Updated Images Using Php
I am running a web page that has multiple web cams. The users are given ftp accounts to upload their web cam images every 30 seconds. What I want to do is instead of having the "refresh" in the header to re-load the entire page from the server every 30 seconds, is to have it re-load only the images that have been updated in the last 30
seconds. This is to cut down on wasted bandwidth. I was thinking of giving each webcam picture its own i-frame, and somehow getting the php to reload the frames containing the images that have recent file modifycation dates.

View Replies !
Database Not Getting Updated
I'm attempting to edit submissions, one page passing the values to a submit page, and the submit page alters the db. Problem is, it's not altering the DB although it states that it is. Here's the code for submit.php in it's entirity: Code:

View Replies !
Database Not Being Updated
On my site I am almost finished designing a forum using PHP and MySQL, but the edit feature is not working and I can not figure out why. Code:

View Replies !
Database Does Not Updated
I want to increase "hit" by 1 but this code cannot update the "hit". Code:

View Replies !
Page Last Updated Question
Most of the pages on the site I manage are html with a few with php
snippits on them which are named .php, on the html pages I have a 'Last
Updated' piece of code as follows

Last updated on <strong><!--#config timefmt="%e %B, %Y"-->
<!--#echo var="LAST_MODIFIED"--></strong>

This works fine and gives me the day, month and year it was last
uploaded to the server. I've tried a few combinations of <?php include
once ( different code snippets here); ?> but can't seem to get it to
show when it was last uploaded, can someone point me in the right direction?

View Replies !
Select On Updated Value During The Fetch
Hi i have a table with all value at 4
i select all lines in a fetch
i update one with a value of 7

i update all the row in the fetch with a value 5

the result is that all my row are at 5
and the only line which should be at 7 is at 5 too.

i see that the problem is at the first mysql_db_query, and i don t know
how to solve it

$query="SELECT * FROM val WHERE str=&#394;'";
$result=mysql_db_query($datamysql,$query);
$query7="UPDATE val SET str=&#397;',updated=&#391;' WHERE val=&#392;'";
$result7=mysql_db_query($datamysql,$query7);

while ($row=mysql_fetch_array($result))
{

$str=$row["str"];
$val=$row["val"];
$query2="UPDATE val SET str=&#395;' WHERE val='$val'";
$result2=mysql_db_query($datamysql,$query2);
}

View Replies !
Uploading Updated Xls Files
I have a problem when I try and update and upload an xls file. It appears that the file has uploaded but when you try and download it its the contents is the same as the old file. Just to make sure it was working i tried it with a .txt file and it updated perfectly. Here is the code that I'm using to upload the files: Code:

View Replies !
Posting Updated Date
is there a php code that posts the date that the database was last updated?

View Replies !
Data Doesnt Get Updated
I am working on a club software which will allow me to manage players and get a list of all the registerd players, i can add, get list of all of the players, but when i try to modify any one of them i cant .

View Replies !
Database Table Is Not Updated
For some reason the database table is not updated. Why is this? PHP Code:

// perform query
$query = "UPDATE centralised_archive.notes ".
                  "SET note = '$note' ".
                 "WHERE date = $record";
                
echo $query;

$result = mysql_query($query) or die(mysql_error());

echoing displays: UPDATE archive.notes SET note = 'TestEDIT archive 27th oct.' WHERE date = 2005-10-26

View Replies !
Variable To Updated Page
I am working on a dynamic webpage. It collects answers from the user and then decide what to show them on the next display. I need some calculation of the answers to
get the decision, so how to pass the decision to the newm page that has the same form but different display data?

View Replies !
Isn't Refreshing Updated Code?
I recently reformatted my computer and reinstalled WAMP5 server like I had before, but now... When I load a page in the browser the first time everything is as it should be, BUT, when I make a change in the php code and refresh the page in the browser, the changes do not take effect, I have to open a new tab and reload the page to see the changes take effect.

Does anyone have any idea why this is happening and more importantly how to resolve this problem?

View Replies !
Convert An IF ELSE Statement To A SWITCH CASE Statement?
How do I convert an IF ELSE statement to a SWITCH CASE statement? The switch case below doesn't work.

$textlen = strlen($descr);

if($textlen>10 && $textlen<50) {
$completeness = 1; $deduct = 1000;
}
elseif($textlen>50 && $textlen<100) {
$completeness = 2; $deduct = 500;
}
else {
$completeness = 0; $deduct = 2000;
}

switch($textlen) {
case >10 && < 50: $completeness = 1; $deduct = 1000; break;
case >50 && < 100: $completeness = 2; $deduct = 500; break;
default: $completeness = 0; $deduct = 2000; break;

View Replies !
Page Last Updated Syntax Error
I tried embedding this in an XHTML file, then changed it to a
last4.php, but get a syntax error. What am I doing wrong?

<?php
$last_modified = filemtime("last4.php");
print("Page Last Updated: ");
print(date("m/j/y h:i", $last_modified));
?> ...

View Replies !
Last Date Updated Syntax Error
I tried embedding this in an XHTML file, then changed it to last4.php,
but get a syntax error. What am I doing wrong?

<?php
$last_modified = filemtime("last4.php");
print("Page Last Updated: ");
print(date("m/j/y h:i", $last_modified));
?>...

View Replies !
Updated SNMP Support For Win32?
I performed binary installs of Net-SNMP and PHP 4.4.4 on my Windows XP
laptop so that I can do some offline development/testing away from my Linux
server. Anyway, I attempted to do some SNMPv3 gets/sets and I am greeted
with "Encryption support not enabled" whenever I try and do any SNMPv3 call.

I thought it was Net-SNMP, so I did some googling and found that you need to
compile Net-SNMP from scrtach with OpenSSL support to get SNMPv3 to work. I
did, and I am now able to do SNMPv3 gets with Net-SNMP. However, I cannot
execute snmp3_get() from any of my PHP scripts, I get the above encryption
message.

I ran phpinfo() on my XP machine and on my linux server and the SNMP section
is quite different, my XP machine has support for "ucd-snmp-4.2.3" and my
linux server has support for "Net-SNMP-5.1.2"

Are there updated versions of php_snmp.dll for a Windows install of PHP? If
so, where can I get them and are they compatible with PHP 4?

View Replies !
Automatic Timestamp When A Record Is Updated
I have several tables in a MySQL database. Is there a way to mark a time stamp (in a DATETIME field )on a record each time the record is updated? I can write an UPDATE statement, but I was wondering if there was a function built-in to MySQL or PHP to time stamp a each record modification in each table.

View Replies !
Script To Record/updated RSVPs
I am looking to find / create a script which will allow visitors a
website RSVP for events. Users will have a unique ID that they receive
in the mail. I would like for them to be presented with a form to
enter this unique ID, and then search the database for events that the
user has been invited to.

There will be a fixed number of events, but the user should only see
events that they are invited to, likely the tombstone data will be in
one table, and the events in a second.

The next page would display tombstone info, which can be updated, and
provide an opportunity for the user to RSVP for each event that they
have been invited to.

View Replies !
Reading A Txt File That Constantly Is Updated
I need to read a txt file with some data that every 3 minutes is updated by ftp. What´s the best way to avoid reading the file while it is being updated (not reading the complete content) and do not blocking the FTP access?

View Replies !
The Iframe Does Not Display The Updated Data
i have an iframe that will allow users to type and edit texts like a text editor. When i try to add some data, it works fine. but the iframe does not update itself when i try to view the data inserted. it displays an old data that has been there before the update. Here is the code for the iframe:

View Replies !
Function That Is Tracking A Record When Updated
I have 2 tables

$tblprefix.basenji and the $tblprefix.tracking
The $tblprefix.basenji contains records and all records have unique basenji_id
the $tblprefix.tracking is only having basenji_id e-mail and action (enum) = sub

From the moment a person press "tracking" of a record, it happens and $tblprefix.tracking register the request in its tabel. basenji_id insert the id of that record from the table $tblprefix.basenji and the email of the person that is tracking that record. Code:

View Replies !
Fields From A Form Aren't Getting Updated
I'm having trouble with sessions. Text fields from a form aren't
getting updated when the form is resubmitted. On the other hand, my
radio buttons are updated every time.

View Replies !
How Long Ago A Mysql Table Was Updated?
Is there a way in php to say how long ago a mysql table was updated? In the table has the time inserted into it when it is updated, but instead of displaying it as "Friday, March 10, 2006" or something, i'd like it to display "2 hours ago" or "3 days ago" etc.

View Replies !
Getting A List Of Updated Mysql Tables
Is it possible to check and see if any mysql tables have been updated.

ie. if a store has added new products, etc.

View Replies !
Sorting Files By Date Created/updated
I use the following code to delete out of date backups.How can I have it delete the oldest file first? The files are sorted with sort($filelist);I need them to be sorted by date. PHP Code:

View Replies !
Php/mysql Problem? -- Phpinfo(); Not Processing Once Php.ini Updated
I installed PHP 5 and MySQL Server 4.1 on my Windows 2000 server.

The documentation at php.net states that after installing MySQL, you must enable php_mysql.dll in php.ini. So I did that, restarted the server, and then tried running phpinfo() to check to see whether MySQL was running.

The phpinfo file wouldn't process. It eventually ended in a CGI timeout. If I comment the php_mysql.dll line back out, phpinfo() processes just fine.

For what it's worth, I also copied libmysql.dll into the WINNT directory, as directed by php.net.

View Replies !
Stop Access Counter - Updated - Coming From Outside
I finaly managed to write the script which logs every user access on the site but now I can not stop it!

My counter is a part of my user record in mySQL 'users' table. The idea was to log the user coming from outside world and not his/her browsing the site, which is the case now. I tried the HTTP_REFERER but it is empty. So I tried a little cheating - on the transfer from the login screen I attached to FORM's ACTION string a little cheat in the form of "?referrer=index", which nicely passes this info for me. After checking password I update the counter and put $referrer = "" - which I expected would stop the intra-site updating. To my surprice it did not. It happily updates the counter every time the user hits this page, which could be 4-10 times at one visit.

View Replies !
Having Trouble Finding Cause Of Header Error... Just Updated To 4.2.1
Warning: Cannot add header information - headers already sent by (output started at C:Apache GroupApache2htdocsestLogin.php:2) in C:Apache GroupApache2htdocs estLogin.php on line 86

I just updated to PHP 4.2.1, and am going through my code updating it, but I cant seem to get past this. I have tried everything, including putting the header('Location:main.php');
exit;

at the very top of the file and still get the error.I cannot find where or what header info. has already been sent.

View Replies !
Php Mysql Update - Echo Not Updated List
I have 2 tables, "Inventory" contains a few details about the shop items, "Shop" contains all the information.  I'm doing it this way because the information is coming from a csv on another server.

So I'm looking for a way to update item quantities between the tables, then echo/print any records that don't exist yet to be updated.

Then I can manually add any new records to my shop database and it will update as usual next time. Anyway, here's what I have so far, but it doesn't display my extra records. Code:

View Replies !
Date Fields In A Table - Last Updated, Next Check Due Etc.
Basically I have a few date fields in a table - last updated, next check due etc. There's also a DateAdded field which defaults to the date the record was created. The default format was 2008-01-01, but I've got that displaying using a recordset in Dreamweaver :

SELECT date_format(DateAdded, '%%D %%b %%Y') as formatted_date FROM developments WHERE DevelopmentID = %s", $colname_dateformat1);

This is fine.

Following this principle I've done another couple for other dates and dropped them in. For dated I'd already added in the 2008-01-01 format, they display correctly.

But my problem now is with entering them - as far as I can tell I'm drawing a blank with either

2008-01-01 or '%%D %%b %%Y'

What's the best practice for entering them in the first place?

View Replies !
Easy Updated Data Driven Site
I seem to have been given the challenge of trying to come up with a way to make a website I have to build have the content able to be easy to update for someone who would not have any knowledge in website development or design.

I am new to php and databases but I have created pages before that when information is put into a form has been displayed on the next page... I am looking for a way to take this type of idea where someone can go to a webpage and input information and then the corresponding page on their site will have the content updated..

View Replies !
If A Mysql Db Table Is Updated For FULLTEXT Searching
When you want to do full-text searching, you have to update your table with a command like this:

ALTER TABLE articles ADD FULLTEXT(body, title);

I was wondering once I've altered my table for fulltext searching, can I still use that table for REGULAR searching using for example, "SELECT * FROM articles WHERE body LIKE '%$keyword%'";? Code:

View Replies !
Create A Database Of Vehicles That Can Be Updated With A .txt File.
I am trying to create a database of vehicles that can be updated with a .txt file.

I own a company that controls used car dealer's inventory. I go out to my clients, enter their cars into my computer program, take digital photos of the cars, and print out a vehicle window label for the cars that I just entered. Code:

View Replies !

Copyright © 2005-08 www.BigResource.com, All rights reserved