Jump to content

Archived

This topic is now archived and is closed to further replies.

kevloink

Php code to insert...

Recommended Posts

I need the php code to insert something into a sql table.
I am using [quote] PHP Version 5.1.7-dev[/quote].


This is the code I am using, and it wont work.
[code]$sql="INSERT INTO users (name, username, password)
VALUES
($name, $user, $pass)";[code][/code][/code]

Share this post


Link to post
Share on other sites
string values need to be in quotes
[code]<?php
$sql="INSERT INTO users (name, username, password)
VALUES
('$name', '$user', '$pass')";
mysql_query ($sql) or die (mysql_error());
?>[/code]

Share this post


Link to post
Share on other sites

×

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.