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
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!
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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...
Link to comment
Share on other sites

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]

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.