my code is
<?php
session_start();
include_once('lib/mysql.php');
$PictMaxSize=30720;
$klasor = "member/pictures/";
$resim=$_FILES['resim']['name'];
$newfile = $klasor.$resim;
$tur=$_FILES['resim']['type'];
$boyut=$_FILES['resim']['size'];
if(isset($_FILES['resim']))
{
if($boyut>$PictMaxSize)
{
echo ("<SCRIPT LANGUAGE='JavaScript'> alert ('Resim Boyutu Büyük'); </SCRIPT>");
exit;
}
if ($tur != "image/gif" and $tur != "image/jpeg" and $tur != "image/pjpeg" and $tur != "image/x-png")
{
echo ("<SCRIPT LANGUAGE='JavaScript'> alert ('Farkli Format'); </SCRIPT>");
exit;
}
$my=new Mysql();
$sql="SELECT user_id from picture where user_id='115'";
$soru =$my->query($sql);
$cevap = $my->fetch($soru);
$adet=$my->numRows($soru);
if ($adet=="0" || $adet=="")
{
$sql2="insert into picture (user_id,picture1,statu1)values('115','$resim','0')";
$yaz=$my->query($sql2);
}
else
{
$say=1;
for ($say=1; $say<6; $say++)
{
if (!isset($cevap['picture'.$say]))
{
$sql3="update picture set picture.$say='$resim' where user_id='115'";
$yaz2=$my->query($sql3);
}
}
}
i want that in my database there were 5 fields about picture.
picture1 , picture2 , picture3 , picture4 , picture5;
if there is no picture for user insert into picture1 if picture1 is not null insert into picture2 or picture2 is not null insert into picture3.
in my db
user_id | picture1 | picture2 | picture3 | picture4 | picture5 |
115 | logo.jpg | logo2.jpg
i want this but with my code
user_id | picture1 | picture2 | picture3 | picture4 | picture5
115 | logo.jpg
115 | logo2.jpg
and numRows function in mysql.php
function numRows($resultSet)
{
$rows = mysql_num_rows($resultSet);
if ($rows == null)
return $this->mysqlRaiseError();
return $rows;
}
sorry for my bad english