kevloink Posted September 25, 2006 Share Posted September 25, 2006 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] Quote Link to comment Share on other sites More sharing options...
Barand Posted September 25, 2006 Share Posted September 25, 2006 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] Quote Link to comment Share on other sites More sharing options...
kevloink Posted September 25, 2006 Author Share Posted September 25, 2006 Thanks, it worked!!! :D Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.