Help me !!!
Moderator: General Moderators
Help me !!!
$sSQL="Update Table1 Set Nombre=$nom".$size." where Legajo='024'";
With this instruction desire to record the content of the field nom,
but does not work. Somebody can say to me if there is a syntax error?
With this instruction desire to record the content of the field nom,
but does not work. Somebody can say to me if there is a syntax error?
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
Re: Help me !!!
OK - so what are the answers to the previous post?lapicki wrote:$size it is a variable that indicates the number of row within the table
$nom it is the entered value to modify the name of that field, from another form
Re: Help me !!!
You sent this to me via PM. What is the error that is produced?lapicki wrote:Code: Select all
<?php MySQL_CONNECT($hostname,$username,$password) or DIE("DATABASE NO RESPONDE"); mysql_select_db($dbName)or DIE("Tabla no disponible"); $result=mysql_db_query("auth","select * from tabla1"); $number = MySQL_NUM_ROWS($result); $size = 1; while($size <= $number) { $sSQL="Update tabla11 Set Nombre=$nom".$size." where Legajo='024'"; echo $sSQL; mysql_db_query("auth",$sSQL)or DIE($sSQL .' :'.mysql_error()); $size++; } mysql_close; ?>
Re: Help me !!!
craigh wrote:You sent this to me via PM. What is the error that is produced?lapicki wrote:Code: Select all
<?php MySQL_CONNECT($hostname,$username,$password) or DIE("DATABASE NO RESPONDE"); mysql_select_db($dbName)or DIE("Tabla no disponible"); $result=mysql_db_query("auth","select * from tabla1"); $number = MySQL_NUM_ROWS($result); $size = 1; while($size <= $number) { $sSQL="Update tabla11 Set Nombre=$nom".$size." where Legajo='024'"; echo $sSQL; mysql_db_query("auth",$sSQL)or DIE($sSQL .' :'.mysql_error()); $size++; } mysql_close; ?>
Two types of errors take place:
1) You have an error in your SQL syntax near '1 where Legajo='024'' at line 1
2) If the instruction is: Set Nombre=$nom".$size."
it records I number of row, is to say $size, instead of recording
the content of the field Nombre
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
Code: Select all
Update Personal1 Set Nombre=''1 where Legajo='024'Your statement is failing because of those single quotes them - you need to have either:
Code: Select all
UPDATE Personal1 SET Nombre = '1' WHERE Legajo='024'Code: Select all
UPDATE Personal1 SET Nombre = 1 WHERE Legajo='024'It also doesn't look as though $nom contains anything.
Mac
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
Have you tried:
You may need to read:
viewtopic.php?t=511
Mac
Code: Select all
$sSQL = "Update Personal1 Set Nombre='".$_POST['nom'].$size."' where Legajo='024'";viewtopic.php?t=511
Mac