Where is the error ???

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
silgol
Forum Newbie
Posts: 11
Joined: Fri Jan 24, 2003 1:31 pm

Where is the error ???

Post by silgol »

<HTML>
<HEAD>
<TITLE>leepersonal.php</TITLE>
<Link rel= "stylesheet" href="default.css">
</HEAD>
<BODY>
<h1><div align="left"><u>Datos Personales</u></div></h1>
<?
echo "<form name='modificar' method=post action='grabamodi.php'>";

$hostname = "localhost";
$username = "xx";
$password = "xxx";
$dbName = "auth";

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 Personal1");
$number = MySQL_NUM_ROWS($result);
echo $number;
echo "<table width=400 align=center border=2 bgcolor='#F0FFFF' cellpadding=1 cellspacing=1 >";
echo "<td align=left>Legajo</td>";
echo "<td align=left>Nombre</td>";
echo "<td align=left>Interno</td>";
echo "<td align=left>Mail</td>";
$size = 1;
while($size <= $number)
{
$row=mysql_fetch_row($result);
echo "
<tr>
<td><input type=text size=3 name=leg".$size." value=$row[3]></td>
<td><input type=text size=25 name=nom".$size." value=$row[1]></td>
<td><input type=text size=8 name=int".$size." value=$row[4]></td>
<td><input type=text size=20 name=email".$size." value=$row[5]>
</tr>";
$size++;
}
echo"</table>";
mysql_close;
?>

<td colspan=5 ><br><input type=submit value='Modificar'>
<input type=hidden name=vuelta value='personaleditor.php'>
</FORM>
</BODY>
</HTML>



<?
$hostname = "localhost";
$username = "xxx";
$password = "xxx";
$dbName = "auth";

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 Personal1");
$number = MySQL_NUM_ROWS($result);
$size = 1;
while($size <= $number)
{
$sSQL="Update Personal1 Set Nombre=$nom".$size.", Interno=$int".$size.", email1=$email".$size." where Legajo=$leg".$size."";
mysql_db_query("auth",$sSQL)or DIE("Error al grabar");
$size++;
}
mysql_close;
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

What is the problem? You have to give some details if you want people to help you - we shouldn't have to go through all your code with no idea of what needs fixing :? .

Mac
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

$sSQL="Update Personal1 Set Nombre=$nom".$size.", Interno=$int".$size.", email1=$email".$size." where Legajo=$leg".$size."";

Code: Select all

mysql_db_query("auth",$sSQL)or DIE($sSQL .' :'.mysql_error()));
and you will find that $sSQL does not contain what you expect it to do.
read http://www.php.net/manual/en/language.v ... riable.php

p.s.: But I agree with Twigletmac
Post Reply