techiefreak05 Posted January 4, 2007 Share Posted January 4, 2007 I have ben building my site on my computer, and its worked fine, until I got a host.. I coded my whole site with MySQL 4.. i think .. but now when I put my files on the host.. they have version 3.. and now all my "UPDATE" queries arent working .. what do I do? When I exported all my sql tables from the phpMyAdmin on my computer, the output code wouldnt work on my host, so I used the "323" compatibility mode when i again exported.. IDK what it means but it works .. so how can i convert all my SQL to a different compatibility?? ???Thanks,Brenden Quote Link to comment Share on other sites More sharing options...
fenway Posted January 5, 2007 Share Posted January 5, 2007 There were some incompatible changes between these versions, syntax too, so that explains it. Quote Link to comment Share on other sites More sharing options...
techiefreak05 Posted January 5, 2007 Author Share Posted January 5, 2007 :-) yeah kinda figured that. lol. well whats the correct syntax for this query?[code]<?php$sql1 = "UPDATE `zpageinfo` SET `film` = '$_POST[film]',`literature` = '$_POST[literature]',`music` = '$_POST[music]',`aboutme` = '$_POST[aboutme]',`friends` = '$_POST[friends]',`gender` = '$_POST[gender]',`school` = '$_POST[select_edu]',`here_for` = '$_POST[here_for]',`city` = '$_POST[city]',`state` = '$_POST[state_select]',`work` = '$_POST[work]',`age` = '$_POST[age]',`css_code` = '$_POST[css_code]',`smoke` = '$_POST[smoke]',`drink` = '$_POST[drink]' WHERE `id` = '$_SESSION[id]' LIMIT 1";mysql_query($sql1) or die(mysql_error());?>[/code]thanks! Quote Link to comment Share on other sites More sharing options...
fenway Posted January 5, 2007 Share Posted January 5, 2007 That looks like it should work in both versions... hmm. Quote Link to comment Share on other sites More sharing options...
techiefreak05 Posted January 5, 2007 Author Share Posted January 5, 2007 thats wierd.. its not.. i even echoed $sql1, but it produced `field`= '', `field`= '', `field`= '', ... WHERE `id` = 1which is wierd because the WHERE `id` = '$_SESSION[id]' part in my code works.. even tho the $_POST variable was not empty .. for some reason .. the $_POST values are being percieved as empty Quote Link to comment Share on other sites More sharing options...
fenway Posted January 6, 2007 Share Posted January 6, 2007 Well, that's not a MySQL problem, that's a PHP issue. Quote Link to comment Share on other sites More sharing options...
techiefreak05 Posted January 8, 2007 Author Share Posted January 8, 2007 would you have any ideas on how to find out why the $_POST variables are empty?? Quote Link to comment Share on other sites More sharing options...
techiefreak05 Posted January 8, 2007 Author Share Posted January 8, 2007 i found something .. this query works:$new_disp = $_POST['newDISP'];$query = "UPDATE users SET DISPNAME = '$new_disp' WHERE id = '$_SESSION[id]'";mysql_query($query);--------but this one doesnt...$sql1 = "UPDATE zpageinfo SET film = '$_POST[film]',literature = '$_POST[literature]',music = '$_POST[music]',aboutme = '$_POST[aboutme]',friends = '$_POST[friends]',gender = '$_POST[gender]',school = '$_POST[select_edu]',here_for = '$_POST[here_for]',city = '$_POST[city]',state = '$_POST[state_select]',work = '$_POST[work]',age = '$_POST[age]',css_code = '$_POST[css_code]',smoke = '$_POST[smoke]',drink = '$_POST[drink]' WHERE `id` = '$_SESSION[id]' LIMIT 1";mysql_query($sql1) or die(mysql_error()); ** would it have something to do with.. the fact that im trying to update more than one culumn in the second query?, everything works fine if I only update one thing at a time... Quote Link to comment Share on other sites More sharing options...
fenway Posted January 8, 2007 Share Posted January 8, 2007 Really hard to say... when you echo $sql1, what do you get? Quote Link to comment Share on other sites More sharing options...
effigy Posted January 8, 2007 Share Posted January 8, 2007 Looks like another case of [url=http://us2.php.net/register_globals]register_globals[/url]. Quote Link to comment Share on other sites More sharing options...
techiefreak05 Posted January 8, 2007 Author Share Posted January 8, 2007 i get this:"UPDATE zpageinfo SET film = '',literature = '',music = '',aboutme = '', etc.... WHERE `id` = '1' LIMIT 1"*all the $_POST variables are gone .. idk why.. i tried putting it into a function.. like this:THE FUNCTION:[code]<?phpfunction doUpdate($a,$b,$c,$d,$e,$f,$g,$h,$i,$j,$k,$l,$m,$n,$o){$update = "UPDATE zpageinfo SET film = '$a', literature = '$b', music = '$c, aboutme = '$d', friends = '$e', gender = '$f', school = '$g', here_for = '$h', city = '$i', state = '$j', work = '$k', age = '$l', css_code = '$m', smoke = '$n', drink = '$o' WHERE id = '$_SESSION[id]'";mysql_query($update) or die(mysql_error());}?>[/code]HOW I USE IT:[code]<?phpdoUpdate($_POST[film],$_POST[literature],$_POST[music],$_POST[aboutme],$_POST[friends],$_POST[gender],$_POST[select_edu],$_POST[here_for],$_POST[city],$_POST[state_select],$_POST[work],$_POST[age],$_POST[css_code],$_POST[smoke],$_POST[drink]);?>[/code] Quote Link to comment Share on other sites More sharing options...
techiefreak05 Posted January 8, 2007 Author Share Posted January 8, 2007 It turns out my host DOES in fact have MySQL 4 ... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.