Jump to content

benthejack

Members
  • Posts

    2
  • Joined

  • Last visited

benthejack's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. *wincescheers that was exactly my problem. lol i spent about 2 hours on a missing pair of quotes!thanks heaps
  2. hi ive just been slaving over this last problem for the last couple of hours (and am starting to get rather annoyed). ive been creating some database interaction scripts which require the insertion of some unknown strings into a database.the code i have so far is $string = "some string";$session = 10;$currentTime = time();$hostname="mysql243.secureserver.net";$username="benthejack";$password="**********";$dbname="benthejack";$con = mysql_connect($hostname,$username, $password) OR DIE ("Unable to connect to database! Please try again later.");mysql_select_db($dbname);mysql_query("INSERT INTO PList (pName, sessionID, timeStamp) VALUES ($string, $session, $currentTime)"); the problem im having is that the INSERT clause fails because of the $string value for some reason.the pName (the column $session goes into) column is a varChar type column, so i dont see why this shouldnt work.it seems to work fine if i put only numbers into the $session string, or if i input a string directly into the INSERT clause.this works: $string = "185"; mysql_query("INSERT INTO PList (pName, sessionID, timeStamp) VALUES ($string, $session, $currentTime)"); and so does this: mysql_query("INSERT INTO PList (pName, sessionID, timeStamp) VALUES ('some string', $session, $currentTime)"); but for some reason i cant get the code i need to work: $string = "some string"; mysql_query("INSERT INTO PList (pName, sessionID, timeStamp) VALUES ($string, $session, $currentTime)"); anyone know why this is?cheersBenthejack
×
×
  • Create New...