Jump to content

[SOLVED] Whats wrong with this MySQL


Vivid Lust

Recommended Posts

Hi, I'm new to MySQL and was just wondering what im doing wrong with this query:

 

<?php
       $unkn = "unknown";
        $zero = "0"; 
        $user = mysql_query("
        INSERT INTO `users` (
`email`,
`pass`,
`name`,
`gender`,
`location`,
`about`,
`s_phish`,
`u_phish`,
`p_phish`,
`p_s`,
)
VALUES (
\"$email\", \"$pass\", \"$name\", \"$unkn\", \"$unkn\", \"$unkn\", \"$zero\", \"$zero\", \"$zero\", \"$zero\"
)

        ")
        or die("could not execute insert query");
?>
[code]

It keeps on dying  

The previous variation worked:

[code]
$user = mysql_query("
        INSERT INTO `users` (
`email` ,
`pass` ,
`name`
)
VALUES (
\"$email\", \"$pass\", \"$name\"
)

        ");

 

But not this one... any help really appreciated :D[/code][/code]

Link to comment
https://forums.phpfreaks.com/topic/122262-solved-whats-wrong-with-this-mysql/
Share on other sites

I get:

 

INSERT INTO `users` ( `email`, `pass`, `name`, `gender`, `location`, `about`, `s_phish`, `u_phish`, `p_phish`, `p_s`, ) VALUES ( "", "", "", "unknown", "unknown", "unknown", "0", "0", "0", "0" )

 

 

Spaces are where variables are which do work, so i suspose they dont really matter at the moment.

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.