473,401 Members | 2,068 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,401 software developers and data experts.

to save pictures to the database (PHP) error

5
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. ob_start();
  3. include("top.php");
  4. include("tabletop.php");
  5. if ( empty($_SESSION['nick']) AND empty($_SESSION['sifre']) AND empty($_GET["ilan"]) ) {
  6. echo "giriş yapmadınız!";}else{
  7. $ilan=$_GET["ilan"];
  8. $sql=mysql_query("select tur from ilanayrinti$ilan where tur='resim'");
  9. $sayisi=mysql_num_rows($sql);
  10. $sqla=mysql_query("update ilan set resim=$sayisi where id=$ilan");
  11. if($sayisi<=4){
  12. require('ekler/fonksiyonlarim.php');
  13. require('ekler/ayarlarim.php');
  14. $ilan=$_GET["ilan"];
  15.  
  16. ?>
  17. <script type="text/javascript">
  18. function highlight(field) {
  19. field.focus();
  20. field.select();
  21. }
  22. var maxWidth=100;
  23. var maxHeight=100;
  24. var fileTypes=["jpg","jpeg","gif","png"];
  25. var outImage="previewField";
  26. var defaultPic="spacer.gif";
  27. /***** DO NOT EDIT BELOW *****/
  28. function preview(what){
  29.   var source=what.value;
  30.   var ext=source.substring(source.lastIndexOf(".")+1,source.length).toLowerCase();
  31.   for (var i=0; i<fileTypes.length; i++) if (fileTypes[i]==ext) break;
  32.   globalPic=new Image();
  33.   if (i<fileTypes.length) globalPic.src=source;
  34.   else {
  35.     globalPic.src=defaultPic;
  36.     alert("BU TÜR DOSYALARI YÜKLEYEMEZSİNİZ!\n\nİzin verilen dosya uzantıları:\n\n"+fileTypes.join(", "));
  37.   }
  38.   setTimeout("applyChanges()",200);
  39. }
  40. var globalPic;
  41. function applyChanges(){
  42.   var field=document.getElementById(outImage);
  43.   var x=parseInt(globalPic.width);
  44.   var y=parseInt(globalPic.height);
  45.   if (x>maxWidth) {
  46.     y*=maxWidth/x;
  47.     x=maxWidth;
  48.   }
  49.   if (y>maxHeight) {
  50.     x*=maxHeight/y;
  51.     y=maxHeight;
  52.   }
  53.   field.style.display=(x<1 || y<1)?"none":"";
  54.   field.src=globalPic.src;
  55.   field.width=x;
  56.   field.height=y;
  57. }
  58. </script>
  59. <?php
  60. if($_POST){
  61. require_once ('ekler/posttan.php');
  62. }
  63. ?>
  64. <style type="text/css">
  65. <!--
  66. .style5 {color: #CCCCCC}
  67. body,td,th {
  68.     font-size: 10px;
  69. }
  70. -->
  71. </style>
  72. </head>
  73. <body>
  74. <center>
  75. <form enctype="multipart/form-data" method=post>
  76. <table width=400 border=0 align=center height="704">
  77.  
  78. <tr>
  79. <td align=center height="1"><b><font size=1 color="#0099FF"><?=$baslik;?><font></b></td></tr>
  80. <tr>
  81.   <td align=center height="8">Yükleyebileceğiniz dosya türleri: .jpg, jpeg, .gif</td>
  82. </tr>
  83.  
  84.  
  85.  
  86. <tr>
  87.   <td height="20" align=center>Yüklenebilir MAXİMUM Dosya Boyutu :
  88.     <?php $maximum_mb = $azami / 1024 / 1024;
  89.         echo number_format($maximum_mb, 2, ",", ".");?>
  90.     MB</td>
  91. </tr>
  92.  
  93. <tr>
  94.   <td align=center height="21"><input name=resim type=file class="file" onChange="preview(this)" size="50"></td>
  95. </tr>
  96.  
  97. <tr>
  98. <select size="0" name="id" style="visibility:hidden;">
  99.                         <?php
  100.  
  101.                                         echo "<option value='$ilan'></option>";
  102.  
  103.                         ?>
  104.                         </select><br>
  105. <td align=center height="25"><input name=gonder type=submit class="file" value="Dosya Yolla"></td>
  106. </tr>
  107. <tr>
  108.   <td height="197" align=center valign="bottom">
  109. <?php
  110.         if($_POST){
  111. if ($boyut >= $azami){
  112. uyari('Dosyanız çok büyük!');
  113. }
  114.                         if ($resim != "" && $boyut <= $azami){
  115. $uzanti_izinlimi = ptIzinlimi($uzanti);
  116.                                         if ($uzanti_izinlimi == 'evet'){
  117.                                         move_uploaded_file ($_FILES['resim']['tmp_name'], $klasor.$yeniresim) or die ('Dosya kopyalanamıyor');
  118. ?><table width="370" border=0 align=center class="uyari2">
  119.  
  120. <tr>
  121.   <td align=center height="239"><b><a href="<?=$link?>" target="_blank"> <img src="<?=$link?>" alt="<?=$link?>" width="150" border=0></a><br>
  122.     Resim Boyutu =
  123.     <?=$boyutkb?>
  124.     </b>
  125. <br>
  126. <strong class="footer"><b>Resmi gerçek boyutta görmek için üzerine tıklayın...<br><br></b> </strong>
  127.       <?php
  128.                                         }
  129.                                         if ($resimismi == ""){
  130.                                         uyari('Dosya Seçin Lütfen!');
  131.                                         }
  132.                                         if ((!$resimismi == "")&&($uzanti_izinlimi == 'hayir')){
  133.                                         uyari('Bu tür dosyaları yükleyemezsiniz!');
  134.                                         }
  135.                         }
  136.                 }
  137. if(!$_POST){
  138. uyari('');
  139. }
  140. ?></td>
  141. </tr>
  142. </table></form>
  143. <?
  144. include("baglanti.php");
  145. $id=$_POST["id"];
  146. if ($resim != "" && $boyut <= $azami){
  147. $sql="insert into ilanayrinti$id(tur,url) values('resim','$link')";
  148.  
  149.                         $kontrol=mysql_query($sql);
  150.                         if($kontrol)
  151.                         {
  152.                                 echo "Resim kayıt işlemi başarılı şekilde yapıldı";
  153.                                 $gidilecekYer = "thumb.php?resim=$link&id=$id";
  154.                                 header ("Location: " . $gidilecekYer);
  155.                                 echo "<br>";
  156.                         }
  157.                         else
  158.                         {
  159.                                 die(mysql_error());
  160.                                 echo "Resim kayıt işlemi yapılırken hata oluştu. Lütfen tekrar deneyiniz.";
  161.                                 echo "<br>";
  162.                         }
  163. ?>
  164. </td>
  165. </tr>
  166.                         <?php
  167.                         {{
  168.  
  169.                                 else                 {
  170.  
  171.  
  172.                         echo "Son Eklediğiniz Resimde Yüklenmiştir. Baska Resim Yükleyemezsiniz. Bir İlana En Fazla 5 Adet Resim Yükleyebilirsiniz. Resim Yükleme Limitiniz Dolmuştur!";
  173.                         }
  174.  
  175.                         include("tabloalt.php");
  176.                         include("alt.php");
  177.                         }
  178.             ?>
this is "real estate site" and People must to add house's picture. But BOLD and UNDELİNE code is problem..

what can I do ?
thanks,
Jul 11 '10 #1
4 1587
dlite922
1,584 Expert 1GB
"else" is the problem?

What's the error code?

What is it doing now?

What should it be doing?

Do you understand the error and Have you tried anything?



Dan
Jul 12 '10 #2
arkhe3
5
@arkhe3
yes "else", 169. line Error code.

this is Real Estate site and I must to add picture to house's. But I can't.
Jul 12 '10 #3
arkhe3
5
@arkhe3
Expand|Select|Wrap|Line Numbers
  1.  }
  2.       else                 
  3.      {
---->> true version the 169. line

okey i can true edit this problem.
Jul 14 '10 #4
dlite922
1,584 Expert 1GB
I was being sarcastic. "else" is a language construct, how can it be the problem, unless you misspell it.

I know you want to add pictures, but we're not here to discuss high level functions of the site, we're programmers.

So can you be a little more specific in answering my previous questions?

Here's what I was looking for:

"I get error Code ABC123 that says this, but I checked X, Y, and Z, and all seem to be as expected. What I expect is to have value FOO in variable $bar on line #, but I get value BAZ. I've put in echo and die statements in place E, F, G, but now I can't seem to understand why line # changes my variable $bar from A to B. "

That's the kind of troubleshooting you need to do to become a good programmer.

Cheers,


Dan
Jul 23 '10 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Frank | last post by:
How do you turn on PHP error messages in PHP, So I can see what is happening when a php page fails ? Windows & Linux ??
7
by: theonlydrayk | last post by:
the script that show image is : <?php include('dbinfo.inc.php'); mysql_connect($localhost,$username,$password); @mysql_select_db($database) or die( "Unable to select database"); $query =...
3
by: Pratchaya | last post by:
Hi Everyone ============================================================== About PHP::: Error/Problem PHP Warning: mysql_fetch_array():...
2
by: nesster13 | last post by:
I have installed Apache and PHP 5 on my machine. I have use Smarty and Pear to help me with the general template of my page. I was able to have a page loaded onto the my browser with not error but...
1
by: newsbandit | last post by:
Hello All, is there a way to specify a php error log for each individual site on an IIS 6 server? If so how, when I turn on logging in the php.ini file it seems to be global and all sites dump to...
0
by: Patrick Peccatte | last post by:
Hi, Is anybody knows any pictures database project written in Python ? Search engine and true database needed (preferably MySQL) I am looking for something similar to "Gallery" (written in PHP),...
14
by: fuchsia555 | last post by:
Is there anyway to hide php error messages? Because i have in my php code error but it redirecting after 1 sec and shows my hosting path and php error number, but this error doesn't effect anything.
2
by: rsmbd | last post by:
I face the problem To Insert data to update data When I go www.myweb.com/cpanel user:xxxxx Pass:xxxx Go Database
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.