MadTechie Posted October 3, 2007 Share Posted October 3, 2007 ok how is that not a standard (excluding the server not being localhost)? alexander007 @ you will not recieve the error //// You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SET comentario='' WHERE id='0'' at line 1 from thats script This what I have on the form that call this script... <?php session_start(); if(!session_is_registered(username)){ header("location:admin.php"); } ?> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> <style type="text/css"> <!-- .style1 { font-size: x-large; font-weight: bold; } --> </style> </head> <body> <?php include"config.php"; $id=$_GET['id']; $tbl_name=$_GET['tbl_name']; $sql="SELECT * FROM $tbl_name WHERE id='$id'"; $result = mysql_query($sql); $row = mysql_fetch_array($result); ?> <div align="center" class="style1">Editar Visitante </div> <form id="form1" name="form1" method="post" action="editvisitante.php"> <table width="730" border="1" align="center"> <tr> <td width="181"><div align="center"><strong>Nombre</strong></div></td> <td width="181"><div align="center"><strong>Telefono</strong></div></td> <td width="181"><div align="center"><strong>Email</strong></div></td> <td width="159"><div align="center"><strong>Comentario</strong></div></td> </tr> <tr> <td><div align="center"><?php echo $row['nombre'];?></div></td> <td><div align="center"><?php echo $row['telefono'];?></div></td> <td><div align="center"><?php echo $row['email'];?></div></td> <td><textarea name="comentario" id="comentario"><?php echo $row['comentario']; ?></textarea></td> </tr> </table> <p> <input name="id" type="hidden" id="id" value="<?php echo $row['id']; ?>"/> <input name="tbl_name" type="hidden" value="<?php echo $tbl_name; ?>"/> </p> <p align="center"> <input type="submit" name="Submit" value="Enviar" /> </p> </form> <?php mysql_close(); ?> Quote Link to comment https://forums.phpfreaks.com/topic/71593-solved-script-dont-work-on-godaddyagain/page/2/#findComment-360511 Share on other sites More sharing options...
alexander007 Posted October 3, 2007 Author Share Posted October 3, 2007 WAIT! Godaddy has a special database connection script. It isn't standard php/mysql. I know because I have godaddy accounts. Maybe this is your problem??? $x = "p83mysql62.secureserver.net" ; $y = "database_name_db" ; $z = "FunKyPassWoRd" ; $xyz = @mysql_connect($x,$y,$z); if (!$xyz) { die('Could not connect to database'); } $db = @mysql_select_db ($y,$xyz); if (!$db) { die ('Database cannot be found'); } I dont think thats the problem...because I can connect to the database etc.... Quote Link to comment https://forums.phpfreaks.com/topic/71593-solved-script-dont-work-on-godaddyagain/page/2/#findComment-360520 Share on other sites More sharing options...
alexander007 Posted October 3, 2007 Author Share Posted October 3, 2007 Any idea? ??? Quote Link to comment https://forums.phpfreaks.com/topic/71593-solved-script-dont-work-on-godaddyagain/page/2/#findComment-360547 Share on other sites More sharing options...
MadTechie Posted October 3, 2007 Share Posted October 3, 2007 about ? as i said the that error isn't from that script.. Quote Link to comment https://forums.phpfreaks.com/topic/71593-solved-script-dont-work-on-godaddyagain/page/2/#findComment-360683 Share on other sites More sharing options...
mag00 Posted October 3, 2007 Share Posted October 3, 2007 As I was learning mysql today, I took a peak at the different commands for sql at the very top the same error message was brought to attention http://dev.mysql.com/doc/refman/5.0/en/reserved-words.html Now I don't fully understand, but this is where I would start looking, Cheers Quote Link to comment https://forums.phpfreaks.com/topic/71593-solved-script-dont-work-on-godaddyagain/page/2/#findComment-360974 Share on other sites More sharing options...
MadTechie Posted October 3, 2007 Share Posted October 3, 2007 erm.. thanx but no reserved-words are used in the sql statement! Quote Link to comment https://forums.phpfreaks.com/topic/71593-solved-script-dont-work-on-godaddyagain/page/2/#findComment-360983 Share on other sites More sharing options...
mag00 Posted October 3, 2007 Share Posted October 3, 2007 $sql="UPDATE $tbl_name SET comentario='$comentario' WHERE id='$id'"; After the UPDATE should there not be some thing else? Update is a command correct? Should there not be a qualifier or something there? According to the mysql site UPDATE is expicity reserved in php 5.0 Now what this all means to me is nothing at this point as I am just starting the mysql and php tutorials. I just ran accross this while learning and posted. I figured the list of reserved words for mysql was important so I even printed it out. I don't remember what version or mysql the OP is using of if he even mentioned it. Godaddy offers 4.1 and 5.0 when setting up the databases. Also godaddy user name and database name are the same if that needs to be considered. Quote Link to comment https://forums.phpfreaks.com/topic/71593-solved-script-dont-work-on-godaddyagain/page/2/#findComment-361033 Share on other sites More sharing options...
MadTechie Posted October 3, 2007 Share Posted October 3, 2007 OK a reserved-word mean it has a use, so you can not use it as a field name, table, etc, unless you use backticks ie $sql="UPDATE $tbl_name SET comentario='$comentario' WHERE id='$id'"; is fine (trust me on that) but $sql="UPDATE $tbl_name SET UPDATE='$comentario' WHERE id='$id'"; would be wrong.. as UPDATE has a special meaning (thus its reserved), the the 2nd would confuse mySQL thus causing an error Quote Link to comment https://forums.phpfreaks.com/topic/71593-solved-script-dont-work-on-godaddyagain/page/2/#findComment-361041 Share on other sites More sharing options...
mag00 Posted October 3, 2007 Share Posted October 3, 2007 I think I understand. Makes more sense. So I am courious as to the progress on this issue, why I have no idea. I guess it is because I use godaddy alot, and if I run into something similar it will be good to know if it is a godaddy specific error. Setting up some of my forums and other opens source stuff, I have run into php.ini problems. Quote Link to comment https://forums.phpfreaks.com/topic/71593-solved-script-dont-work-on-godaddyagain/page/2/#findComment-361191 Share on other sites More sharing options...
alexander007 Posted October 3, 2007 Author Share Posted October 3, 2007 about ? as i said the that error isn't from that script.. about the error...the error isnt on the confi.php...because I can connect to the database etc.... the problem is in the script that updates the table on the database...I suppose.... ??? //// You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SET comentario='' WHERE id='0'' at line 1 Quote Link to comment https://forums.phpfreaks.com/topic/71593-solved-script-dont-work-on-godaddyagain/page/2/#findComment-361241 Share on other sites More sharing options...
mag00 Posted October 3, 2007 Share Posted October 3, 2007 Can you set up new databases? One using php 4.1 and one using php 5? Then see if it works on one or the other. Quote Link to comment https://forums.phpfreaks.com/topic/71593-solved-script-dont-work-on-godaddyagain/page/2/#findComment-361277 Share on other sites More sharing options...
alexander007 Posted October 4, 2007 Author Share Posted October 4, 2007 Can you set up new databases? One using php 4.1 and one using php 5? Then see if it works on one or the other. I will try that Quote Link to comment https://forums.phpfreaks.com/topic/71593-solved-script-dont-work-on-godaddyagain/page/2/#findComment-361308 Share on other sites More sharing options...
tcollie Posted October 4, 2007 Share Posted October 4, 2007 about ? as i said the that error isn't from that script.. about the error...the error isnt on the confi.php...because I can connect to the database etc.... the problem is in the script that updates the table on the database...I suppose.... ??? //// You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SET comentario='' WHERE id='0'' at line 1 Is there actually a record with the ID '0' since you're trying to UPDATE a record and not INSERT a record? Quote Link to comment https://forums.phpfreaks.com/topic/71593-solved-script-dont-work-on-godaddyagain/page/2/#findComment-361422 Share on other sites More sharing options...
alexander007 Posted October 5, 2007 Author Share Posted October 5, 2007 about ? as i said the that error isn't from that script.. about the error...the error isnt on the confi.php...because I can connect to the database etc.... the problem is in the script that updates the table on the database...I suppose.... ??? //// You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SET comentario='' WHERE id='0'' at line 1 Is there actually a record with the ID '0' since you're trying to UPDATE a record and not INSERT a record? no... really I dont know what its causing this problem..I try everything...all looks ok....any more idea in what it could be? Quote Link to comment https://forums.phpfreaks.com/topic/71593-solved-script-dont-work-on-godaddyagain/page/2/#findComment-362168 Share on other sites More sharing options...
alexander007 Posted October 5, 2007 Author Share Posted October 5, 2007 I resolve the problem... I just add this: <?php include"../config.php"; extract($_POST); $sql = "UPDATE $tbl_name SET comentario='$comentario' WHERE id = '".$id."'"; $result=mysql_query($sql)or die(mysql_error()); if($result){ echo "<center>Cambio se realizo satifactoriamente.</center>"; echo "<BR>"; echo "<center><a href='../admin/viewvisitante.php'>Volver Atras</a><center>"; } else { echo "ERROR"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/71593-solved-script-dont-work-on-godaddyagain/page/2/#findComment-362175 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.