New to PHP and MySQL and help bad!

Reply

Join Date: Apr 2005
Posts: 3
Reputation: buck_nakie is an unknown quantity at this point 
Solved Threads: 0
buck_nakie buck_nakie is offline Offline
Newbie Poster

New to PHP and MySQL and help bad!

 
0
  #1
Apr 16th, 2005
Hi all,

I am learning to write with PHP and am stuck and need some wise souls help.
In a nutshell I need to be able to take grab a DB coulmn status and then count how many times it gets updated and output that number to a file and then have that number add to what the number was before. I have every thing working but getting the number. Here is the bit of code I have so far so it will be easier to figure what I need



function CountDefUpdates ()
{
//GetICMSData

UpdateICMS("UPDATE desktops SET status = \"dupend\" WHERE status = \"installed\" AND spy_policy_index = 2",$link);

$newcount = mysql_query ("SELECT

$file="count.txt";

$fh1=fopen($file,"r");
$count=fscanf($fh1,"%d");
fclose($fh1);

//echo $newcount;
//echo $count[0];

$fh=fopen($file,"w+");
$count[0]=$count[0]+$newcount;

fprintf($fh,"%d",$count[0]);
fclose($fh);

thanks for looking
Reply With Quote Quick reply to this message  
Join Date: Feb 2005
Posts: 355
Reputation: DanceInstructor is an unknown quantity at this point 
Solved Threads: 14
DanceInstructor's Avatar
DanceInstructor DanceInstructor is offline Offline
Posting Whiz

Re: New to PHP and MySQL and help bad!

 
0
  #2
Apr 16th, 2005
Well this line will definitly cause you some problems:

$newcount = mysql_query ("SELECT
Clear Mind Hosting and Web Design

If I've helped you please consider adding to my reputation.
Reply With Quote Quick reply to this message  
Join Date: Apr 2005
Posts: 3
Reputation: buck_nakie is an unknown quantity at this point 
Solved Threads: 0
buck_nakie buck_nakie is offline Offline
Newbie Poster

Re: New to PHP and MySQL and help bad!

 
0
  #3
Apr 16th, 2005
yes that is a problem but I was removing back to $newcount=() and didn't get it all. So if anyone can help please do. If I hard code a number in there that is what gets outputted to my text file .

thank you
Reply With Quote Quick reply to this message  
Join Date: Mar 2004
Posts: 765
Reputation: Phaelax is on a distinguished road 
Solved Threads: 38
Phaelax Phaelax is offline Offline
Master Poster

Re: New to PHP and MySQL and help bad!

 
0
  #4
Apr 17th, 2005
$count[0]=$count[0]+$newcount;
$newcount isn't a number, its an sql result object and therefore you cannot add objects like that together.

I'm not entirely sure what you're trying to do. Are you're trying to keep track of how many times a column is updated?
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC