Inserting java script to sql

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
GK
Forum Commoner
Posts: 51
Joined: Sat Jun 07, 2003 2:58 pm
Contact:

Inserting java script to sql

Post 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?
User avatar
werlop
Forum Commoner
Posts: 68
Joined: Sat Mar 22, 2003 2:50 am
Location: /dev/null

Post 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.
User avatar
nielsene
DevNet Resident
Posts: 1834
Joined: Fri Aug 16, 2002 8:57 am
Location: Watertown, MA

Post by nielsene »

I suspect the problem is that you are not escaping the single quotes in the code you are sticking into the database.
Post Reply