I have spent a lot of google time on this and im not sure about the best way I would need to go about it
I have a small web program that adds number into a database with query that runs on selections, to clear certain information out, these query only succeed if the numbers in a certain column are 13 digits long, why I don't know.
So my question is what is the best way to make the digits in the column in sql autoconvert to 13 using either sql or php so if i where to type 1 it would end up in the sql column as 0000000000001 instead of 1
The query I have php running is very simple I don't quite understand why it has to have 13
The code is as follow
<?php include_once "ewcfg9.php" ?>
<?php include_once "adodb5/adodb.inc.php" ?>
<?php include_once "phpfn9.php" ?>
<?php include_once "Productsinfo.php" ?>
<?php include_once "userfn9.php" ?>
<?php
$upc= $_GET['upc'];
sleep(2);
header('Location: Productsedit2.php?upc='.$upc.'');
$serverName = "localhost";
$usr="sl";
$pwd="o.o";
$db="SimpleLabel";
$connectionInfo = array("UID" => $usr, "PWD" => $pwd, "Database" => $db);
$conn = sqlsrv_connect($serverName, $connectionInfo);
if ($conn === false)
{
print_r( sqlsrv_errors());
}
$sql="Delete from labelprint where upc=$upc";
$query = sqlsrv_query($conn, $sql) or die(sqlsrv_errors());
$result=sqlsrv_fetch_array($query);
print_r($result);
sqlsrv_close( $conn);
?>
This works but only if the upc=13 digits so can anyone think if there is a way i can make sql make everything 13 digits or make php autofill the field with 13 digits?