|
|
|||||||||
|
|||||||||
|
|||||||||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
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
|
|||
|
|||
|
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 |
|
#2
|
|||
|
|||
|
make sure ur second query has a different var, but without seeing the code, its hard to say whats causing the problem
|
|
#3
|
|||
|
|||
|
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 ![]() |
|
#4
|
|||
|
|||
|
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:
|
|
#5
|
|||
|
|||
|
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? |
|
#6
|
|||
|
|||
|
just for testing purposes try placing the 2nd query in a new file, and run it. Does that work?
|
|
#7
|
|||
|
|||
|
no go...
okay ive just tried in a new file like you said... and its still not working???
im baffled... any more ideas? |
|
#8
|
|||
|
|||
|
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 |
![]() |
| Viewing: Dev Articles Community Forums > Programming > PHP Development > Php Mysql Update |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|