PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
Iron Speed
 
Go Back   Dev Articles Community ForumsProgrammingPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Free Web 2.0 Code Generator! Generate data entry and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
  #1  
Old September 10th, 2002, 08:54 AM
stuie stuie is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: Brisbane, Australia
Posts: 38 stuie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 10 m 52 sec
Reputation Power: 7
Php Mysql Update

hi

ive got a small problem I dont have my code here but i should be able to explain it and if anyone can tell me if there is something going on that im oblivious to that would be good.

i run two update queries one after the other using mysql_query($sql); thats fine for the first query but the second one doesnt work. if i output the code and run it in mysql manually it works as i would expect.

is there something im not quite getting?

any ideas are much appreciated!

cheers

stu

Reply With Quote
  #2  
Old September 10th, 2002, 07:09 PM
Ben Rowe
Guest
Dev Articles Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
make sure ur second query has a different var, but without seeing the code, its hard to say whats causing the problem

Reply With Quote
  #3  
Old September 11th, 2002, 03:40 AM
stuie stuie is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: Brisbane, Australia
Posts: 38 stuie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 10 m 52 sec
Reputation Power: 7
here is my code!

$dbQuery = "UPDATE photos SET main_flag = 0 ";
$dbQuery .= "WHERE car_id = $car_id;";
mysql_query($dbQuery);

$dbQuery = "UPDATE photos SET main_flag = 1 ";
$dbQuery .= "WHERE photo_id = $photo_id;";
mysql_query($dbQuery);

thats the code. if i echo the $dbQuery on two occassions it give me what i want, its just that mysql_query doesnt like something.

ive never had any problems executing a query using the same var name before... can someone explain if thats the problem and why thats a problem...im curious.

thanks all!

stu

Reply With Quote
  #4  
Old September 11th, 2002, 12:56 PM
crazytrain81 crazytrain81 is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2002
Posts: 232 crazytrain81 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
a few things

I suggest either unsetting $dbQuery with unset($dbQuery); or setting it to NULL before re-initializing it with a different value, just for clarity sake.

Also, try putting some error checking into your code, for example:
PHP Code:
if ($goodInsert mysql_query($dbQuery) ) {
     echo 
"Success";
     }
else {
     echo 
mysql_error();
     } 

Reply With Quote
  #5  
Old September 14th, 2002, 12:05 AM
stuie stuie is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: Brisbane, Australia
Posts: 38 stuie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 10 m 52 sec
Reputation Power: 7
still no luck

hi

im still having no luck..

$dbQuery = "UPDATE photos SET main_flag = 0 ";
$dbQuery .= "WHERE car_id = $car_id;";
if($result = mysql_query($dbQuery))
{
echo "Success";
}

$dbQuery1 = "UPDATE photos SET main_flag = 1 ";
$dbQuery1 .= "WHERE photo_id = $photo_id;";
if($result = mysql_query($dbQuery1))
{
echo "Success again";
}

thats my code... is there some sort of issue executing consequtive update queries???

any help would be good?

Reply With Quote
  #6  
Old September 14th, 2002, 12:48 AM
Ben Rowe
Guest
Dev Articles Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
just for testing purposes try placing the 2nd query in a new file, and run it. Does that work?

Reply With Quote
  #7  
Old September 14th, 2002, 01:01 AM
stuie stuie is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: Brisbane, Australia
Posts: 38 stuie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 10 m 52 sec
Reputation Power: 7
no go...

okay ive just tried in a new file like you said... and its still not working???

im baffled... any more ideas?

Reply With Quote
  #8  
Old September 14th, 2002, 12:23 PM
FrankieShakes FrankieShakes is offline
Frank The Tank!
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: Jun 2002
Location: Toronto, Canada
Posts: 1,246 FrankieShakes User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via ICQ to FrankieShakes Send a message via MSN to FrankieShakes
Stuie,

Either attach the code you're working with, or post a little more... I'm wondering if it has anything to do with your variables, $photo_id and $car_id.

Also, are you using the superglobals, $_POST and $_GET?

Do you receive any error messages at all?
__________________
____________________________________________
Developer Shed Weekly Writer | DevArticles Forum Moderator
Build Your Own KlipFolio Klip With PHP
FrankManno.com - Under Construction
Design Interactive Group - Under Construction

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingPHP Development > Php Mysql Update


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five &quot;checkpoints&quot; for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 

Iron Speed




© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway