Page 1 of 1

Inserting java script to sql

Posted: Fri Aug 01, 2003 12:41 pm
by GK
Hi all

i run a script on my testing server and all runs fine

now i moved it to a other server for more testing
all runs ook accept my submit part

i get an error

You have an error in your SQL syntax near 'http://www.msn.nl' WinPop=window.open(PopUpUrl,'','width=800,height=600,tool' at line 1

it looks like it doesn;t like this somehow (its a option in my form)

Code: Select all

<select name="extra2" size="1"> 
            <option value="function PopUp(){ 
    var ScreenWidth=window.screen.width; 
    var ScreenHeight=window.screen.height; 
    var movefromedge=0; 
    placementx=(ScreenWidth/2)-((400)/2); 
    placementy=(ScreenHeight/2)-((300+50)/2); 
    var PopUpUrl='<? echo $rows[url]; ?>' 
    WinPop=window.open(PopUpUrl,'','width=<? echo $rows[width]; ?>,height=<? echo $rows[height]; ?>,toolbar=<? echo $rows[toolbar]; ?>,location=<? echo $rows[location]; ?>,directories=<? echo $rows[dirs]; ?>,status=<? echo $rows[status]; ?>,scrollbars=<? echo $rows[scroll]; ?>,menubar=<? echo $rows[menubar]; ?>,resizable=<? echo $rows[resize]; ?>,left='+<? echo $rows[links]; ?>+',top='+<? echo $rows[top]; ?>+',screenX='+<? echo $rows[screenx]; ?>+',screenY='+<? echo $rows[screeny]; ?>+','); 
   }"selected>Simple popup Onload and pops every time!</option> 
          </select>
can someone help me?

Posted: Fri Aug 01, 2003 5:43 pm
by werlop
I don't think this has anything to do with your problem, but remember you should always use quotes when using arrays, eg $rows[url]; is wrong, but $rows["url"]; is correct.

To help you with your problem, could you post more of your code, eg your origional SQL statement, and how you got the vars, eg did you use mysql_fetch_array() or something else.

Posted: Fri Aug 01, 2003 7:02 pm
by nielsene
I suspect the problem is that you are not escaping the single quotes in the code you are sticking into the database.