mysql: will not insert, same code has worked for me before.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
zyklon
Forum Commoner
Posts: 49
Joined: Mon Jul 31, 2006 7:14 pm
Location: MA, USA

mysql: will not insert, same code has worked for me before.

Post by zyklon »

Code: Select all

$idid=$userd['id'];
mysql_query("INSERT INTO newsinf (rtime,message,toid) VALUES ('".time()."','<b>$j','$idid')");
$idid=$attacke['id'];
mysql_query("INSERT INTO newsinf (rtime,message,toid) VALUES ('".time()."','<b>$q','$idid')");
Thats the code, all the stuff in the table exists, $j and $q are set as strings. [s]u[/s] you can see $idid set, there is no reason for it to not work.
[url=http://forums.devnetwork.net/viewtopic.php?t=30037]Forum Rules[/url] Section 1.1 wrote:11. Please use proper, complete spelling when posting in the forums. AOL Speak, leet speak and other abbreviated wording can confuse those that are trying to help you (or those that you are trying to help). Please keep in mind that there are many people from many countries that use our forums to read, post and learn. They do not always speak English as well as some of us, nor do they know these aberrant abbreviations. Therefore, use as few abbreviations as possible, especially when using such simple words.

Some examples of what not to do are ne1, any1 (anyone); u (you); ur (your or you're); 2 (to too); prolly (probably); afaik (as far as I know); etc.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Proof MySQL is refusing this is where?
User avatar
zyklon
Forum Commoner
Posts: 49
Joined: Mon Jul 31, 2006 7:14 pm
Location: MA, USA

Post by zyklon »

it isn't being put into the table, but there is no mysql error being shown on the page.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

No error being shown on page can be that you don't have error checking. Post more code.
User avatar
zyklon
Forum Commoner
Posts: 49
Joined: Mon Jul 31, 2006 7:14 pm
Location: MA, USA

Post by zyklon »

all the things above it and around it work. it is just those 4 lines. that don't appear to be working, should I put in a

Code: Select all

or die(mysql_error());
at the end of each line??
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Have you tried it?
User avatar
zyklon
Forum Commoner
Posts: 49
Joined: Mon Jul 31, 2006 7:14 pm
Location: MA, USA

Post by zyklon »

is it possible to overload a string??

Code: Select all

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near
then it gives me part of what is in $j, though i checked the part it stops, and there is nothing there to cause the problem.


edit: fixed it i had a ' in the middle of the part i inserted into the string:)
Post Reply