ajutor inserare in tabel mysql...sunt beginner la maxim :)
Scris: Mie Ian 24, 2007 11:57 pm
Poate ma ajutati acum cu o problema la inserare intr-un tabel mysql. Am un tabel cu 2 campuri, unul numeric care e index si unul text si incerc sa inserez in ele prin php si imi da urmatoarea eroare de la mysql:
Could not run the query: Out of range value adjusted for column 'id_marca' at row 1
Asta e scriptul de inserare in tabel:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>insert marca</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?php
$link = mysql_connect("*****", "******", "******")
or die("Could not connect: " . mysql_error());
print ("Connect sucessfully ");
mysql_select_db ( "masini", $link )
or die("Could not select db: " . mysql_error());
print ("Select db successfully ");
$id_marca = $HTTP_POST_VARS['id_marca'];
$nume = $HTTP_POST_VARS['nume'];
$query = "INSERT INTO marci ( id_marca, nume ) ";
$query .= "values ( '{$id_marca}', '{$nume}' ) ";
$result = mysql_query($query, $link)
or die("Could not run the query: " . mysql_error());
print ("Run query successfully ");
print (" ");
mysql_close($link);
?>
</body>
</html>
</body>
</html>
Imi afiseaza connect succesfully si select succesfully si pe urma eroarea aia. Ma gandesc ca o fi din cauza ca, campul id_marca e de tip numeric.
Could not run the query: Out of range value adjusted for column 'id_marca' at row 1
Asta e scriptul de inserare in tabel:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>insert marca</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?php
$link = mysql_connect("*****", "******", "******")
or die("Could not connect: " . mysql_error());
print ("Connect sucessfully ");
mysql_select_db ( "masini", $link )
or die("Could not select db: " . mysql_error());
print ("Select db successfully ");
$id_marca = $HTTP_POST_VARS['id_marca'];
$nume = $HTTP_POST_VARS['nume'];
$query = "INSERT INTO marci ( id_marca, nume ) ";
$query .= "values ( '{$id_marca}', '{$nume}' ) ";
$result = mysql_query($query, $link)
or die("Could not run the query: " . mysql_error());
print ("Run query successfully ");
print (" ");
mysql_close($link);
?>
</body>
</html>
</body>
</html>
Imi afiseaza connect succesfully si select succesfully si pe urma eroarea aia. Ma gandesc ca o fi din cauza ca, campul id_marca e de tip numeric.