MySQL Insert not working
I am trying to insert into a mysql db, which I've done a million times before, but it won't work this time! I've tried everything I can think of a million times over!
code snippet:
<?php
$password = md5($password);
mysql_query(\"INSERT INTO `$db[pre]users` (`id`, `username` , `password` , `email` , `aim` , `icq` , `msn` , `active` , `wesbsite` , `userlevel` , `comments` ) VALUES ('', '$username', '$password', '$email', '', '0', '', '1', 'http://', '1', '0')\");
?>
I also tried:
<?php
$password = md5($password);
mysql_query(\"INSERT INTO `$db[pre]users` (`username` , `password` , `email`, `active`, `userlevel`) VALUES ('$username', '$password', '$email', '1', '1')\");
?>
I tried a few others, but I knew they wouldn't work. I just did it to make sure
[James Logsdon]
Mark Hensler posted this at 03:53 — 10th October 2002.
He has: 4,048 posts
Joined: Aug 2000
Try assigning your query to a variable ($query), then echo it out. I'm guessing that "`$db[pre]users`" isn't what your expecting.
necrotic posted this at 01:35 — 11th October 2002.
He has: 296 posts
Joined: May 2002
So what you mean is set it to $query or something like that then echo it out? I'll try that real quick.
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.