Jump to content

SQL Compatiblity issues .. ?


techiefreak05

Recommended Posts

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
Link to comment
https://forums.phpfreaks.com/topic/32900-sql-compatiblity-issues/
Share on other sites

:-) 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!
thats wierd.. its not.. i even echoed $sql1, but it produced

`field`= '', `field`= '', `field`= '', ... WHERE `id` = 1

which 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
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...
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]
<?php
function 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]
<?php
doUpdate($_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]

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.