Jump to content

[SOLVED] Problem: MySQL query won't seem to execute


Id_42

Recommended Posts

I'm having what seems to me to be a really strange problem. The following query (with a bit of extra code for context) doesn't seem to work at all:

 

$savemap = serialize($_SESSION['desertmap']);
mysql_query("INSERT INTO deserttable (OwnerID, Positions) VALUES ({$_SESSION['PlayerID']}, {$savemap});");

 

$_SESSION['desertmap'] works fine, and $savemap works fine when echoed (giving me things like "a:16:{i:11;i:1;i:12;i:2;i:13;i:1;i:14;i:4;i:21;i:1;i:22;i:1;i:23;i:2;i:24;i:3;i:31;i:2;i:32;i:2;i:33;i:1;i:34;i:1;i:41;i:2;i:42;i:2;i:43;i:9;i:44;i:1;}", as I would expect it to). I just can't get any query that attempts to store $savemap to work correctly - and what's strange is that PHP isn't delivering any error messages of any kind, it's just failing to work. And I do know that that part of the script is working, as I've thrown in a couple of throwaway messages before and after the query that are displaying as they should be, so it's not like there's some sort of faulty if statement that's preventing it from getting triggered at all. And it's not, I think, that the table's defined wrong, as I've tried putting $savemap into a different table entirely, in a field that I know is set as CHAR (255), and it doesn't work any better there.

 

Any thoughts? Helpplz? Banging my head against this isn't getting me anywhere at this point. :(

 

Thanks!

Link to comment
Share on other sites

Yes, I'm connected to my database, and no, it's not giving me any error messages at all - it's just not working.

 

Wait - no, now it is, having grabbed a random snippet of code from a part of the project someone else did. I'm not sure exactly what the deal is, but, uh, problem solved. ^_^

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.