Jump to content


Photo

HELP! Passing variables into an INSERT query


  • Please log in to reply
1 reply to this topic

#1 Robski

Robski
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 09 October 2006 - 01:01 PM

This code works fine on my computers' server but when I copy it over to my web space it doesn't:

$name = 'Random';
$password = 'passRandom';

$query = "INSERT INTO Names (name,password) VALUES ('$name','$password')";

mysql_query($query) or die ('Error, insert query failed');

- I can get it to pass strings into the database...just not variables.
- I've emailed my web hosting people and they said I can use the syntax:

$query = "INSERT INTO Names (name,password) VALUES (' ".$name." '.' ".$password." ' )"

But this doen't work either.

Any Ideas?

#2 Robski

Robski
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 09 October 2006 - 03:03 PM

No worries.....sorted it out....Auto Increment didn't pass over to the online database when I imported my tables




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users