Jump to content

dh091275

New Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

dh091275's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thanks managed to get it to work with this... $sql1 = "INSERT INTO Url_User (Userid,Urlid) SELECT '$entry[userid]', Urlid from Urls where url='$x'"; mysql_query($sql1); I was just getting confused. I created the orginally query in myphpadmin and generated the php code from there. Thought that i would be able to just insert the variables. Thanks again
  2. MySQL client version: 4.0.16 Ok i am having a little problem with the following converting mysql into php. Using the following mysql statement INSERT INTO Url_User( Userid, Urlid ) SELECT 'bob', Urlid FROM Urls WHERE url = 'www.excel.com'; Now I can get the following code to work if i hard code it e.g(Bob and www..adobe.com). $sql = 'INSERT INTO Url_User( Userid, Urlid ) ' . ' SELECT \'bob\', Urlid' . ' FROM Urls' . ' WHERE url = \'www.excel.com\';'; mysql_query ($sql); the problem that i have is when i try to insert variables into the sql statement. For example, if i replace bob with $x (e.g. $x = bob1;) then the code doesnt pick up the variable it inserts "$x" into the table. Now if i strip the \' s from the code (ie \'$x\' to $x) it still doesn't work. Any suggestions?
×
×
  • 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.