Devilzc0de Forum Follow @devilzc0de
  • Home
  • Hacking
  • Networking
  • Programming
  • O.S
  • Server
  • Tweets
  • Search
  • Member List
  • Calendar
Current time: 05-22-2013, 10:49 PM Hello There, Guest! (Login — Register)
Devilzc0de Forum › Information Technology › Database › Mysql v
« Previous 1 2 3 Next »

[Ask] Error mysql query & array

Home General Computer Multimedia Business Lounge

Pages (2): « Previous 1 2
Post Reply 
Tweet
Threaded Mode | Linear Mode
Ask Error mysql query & array
08-17-2011, 05:57 PM (This post was last modified: 08-17-2011 05:58 PM by Emily.Josan♫.)
Post: #11
Emily.Josan♫ Away
*Mod Tercantik*
**
Moderators
Posts: 583
Joined: Jul 2010
Reputation: 168
RE: Error mysql query & array
(08-17-2011 05:43 PM)t3k0 Wrote:  di file yourum.php nya belum di include kan file koneksinya om.... smoke

tambah fatal om...

klo script yg ini
Code:
`yazid`='$id' and `onay`='1' order by id desc");
di hilangin, yg connect dngn yorum.php malah bs.. tapi yorum.phpnya ttp error..

atau om t3ko bs kasih contoh hmm
Visit this user's website Find all posts by this user
Quote this message in a reply
08-17-2011, 06:24 PM (This post was last modified: 08-17-2011 06:25 PM by mariachi.)
Post: #12
mariachi Away
has been reboot
**
Moderators
Posts: 2,362
Joined: Nov 2010
Reputation: 55
RE: Error mysql query & array
(08-17-2011 05:57 PM)x_wungu Wrote:  
(08-17-2011 05:43 PM)t3k0 Wrote:  di file yourum.php nya belum di include kan file koneksinya om.... smoke

tambah fatal om...

kok tambah fatal, kalo gak di include kan file koneksinya gimana mau ada koneksi ke databasenya... nohope

oke saya kasih contoh

file konek.php
Code:
<?

$host = "localhost";
$user = "root";
$pass = "toor";
$db = "conto";

mysql_connect("$host","$user","$pass") or die("tidak bisa koneksi ke server");
mysql_select_db("$db") or die ("tidak bisa koneksi ke database");
?>

file yorum.php
Code:
<?
include('konek.php'); //file konek.php harus satu direktori dengan file ini
$id=(int)$_GET['id'];

$sql=mysql_query("select * from contoh where id=$id");

while($result=mysql_fetch_array($sql)){
$judul = $result['judul'];
$isi = $result['isi_artikel'];
print "<center><b>$judul<br></b></center><font color=black>$isi...</font>";
}
?>

semacam itu kira2. silahkan dimodifikasi sendiri..... smoke
Find all posts by this user
Quote this message in a reply
08-17-2011, 06:40 PM (This post was last modified: 08-17-2011 06:55 PM by Emily.Josan♫.)
Post: #13
Emily.Josan♫ Away
*Mod Tercantik*
**
Moderators
Posts: 583
Joined: Jul 2010
Reputation: 168
RE: Error mysql query & array
(08-17-2011 06:24 PM)t3k0 Wrote:  
(08-17-2011 05:57 PM)x_wungu Wrote:  
(08-17-2011 05:43 PM)t3k0 Wrote:  di file yourum.php nya belum di include kan file koneksinya om.... smoke

tambah fatal om...

kok tambah fatal, kalo gak di include kan file koneksinya gimana mau ada koneksi ke databasenya... nohope

oke saya kasih contoh

file konek.php
Code:
<?

$host = "localhost";
$user = "root";
$pass = "toor";
$db = "conto";

mysql_connect("$host","$user","$pass") or die("tidak bisa koneksi ke server");
mysql_select_db("$db") or die ("tidak bisa koneksi ke database");
?>

file yorum.php
Code:
<?
include('konek.php'); //file konek.php harus satu direktori dengan file ini
$id=(int)$_GET['id'];

$sql=mysql_query("select * from contoh where id=$id");

while($result=mysql_fetch_array($sql)){
$judul = $result['judul'];
$isi = $result['isi_artikel'];
print "<center><b>$judul<br></b></center><font color=black>$isi...</font>";
}
?>

semacam itu kira2. silahkan dimodifikasi sendiri..... smoke

tadi fatal karna salah direktori om malu. ga satu direktory trnyata bs om.
yg jdi permasalhn slnjtnya mash kluar
Code:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in
apa slsh isinya ya om

ni om t3k0
Code:
<?
include('xxx/db.php');
$id=(int)$_GET['id'];

$sec=mysql_query("select * from yorumlar where 1 `yazid`='$id' and `onay`='1' order by id desc ");

while($yorum=mysql_fetch_array($sec)){

    
    echo'<hr size=1 color=red><br /><font color="black"><a href="mailto:'.$yorum['mail'].'"><font color=red size=2>'.$yorum['ad'].'</font></a> Adlý Kiþi ,   '.$yorum['tarih'].' Tarihinde Demiþ ki </font>;';

    echo'<br />';

    echo $yorum['mesaj'].'';

    echo'<br />';

    }

echo'<table height="12" width="100%"><tr><td background="images/x.gif"> </td></tr></table>';

?>
<br><br>
<style type="text/css">



input1{

background-color:#333333;

border:1px dashed #666666;

font-family:Tahoma;

font-size:11px;

color:#999999;

}

input1:hover{

border:1px dashed #666666;

}



textarea1{

background-color:#333333;

border:1px dashed #666666;

font-family:Trebuchet MS;

font-size:11px;

color:#999999;

}

textarea1:hover{

border:1px dashed #666666;

}

.mesaj1{

background-color:#333333;

font-size:11px;

color:#ffffff;

padding:4;}

</style>
<script language="JavaScript1.2">

function ClearError() {

return true;}

window.onerror = ClearError;

</script>



<script  language="JavaScript">        

function openWin(theURL,winName,features) {

      window.open(theURL,winName,features);}

</script>



<script  language="JavaScript">

function ForumJump(URL) {

    if (URL.options[URL.selectedIndex].value != "") self.location.href = URL.options[URL.selectedIndex].value;    

    return true;}

</Script>





<script language="JavaScript">

function Toggle( secid ){

    var sectionId = document.getElementById(secid);

    if (sectionId == null) return;

    if (sectionId.style.display == '')

    {

        sectionId.style.display = 'none';}

    else{

        sectionId.style.display = '';}}



function Hide( obj ){

    var oDiv = document.getElementById(obj);

    if(oDiv != null) oDiv.style.display = "none";}



function chkHide(id){

    var isPF = (typeof(IsPrinterFriendly) != "undefined");

    if(document.getElementById && !isPF){ Hide(id); }}

</script>

<script language="javascript">sID='3l1-ECBAA';writePM(sID)</script>

                  <script language="javascript">startA('s'+sID)</script>

                  &nbsp;

                    <a onClick="javascript:Toggle('s3l1-ECBAA')" name="Submit"><input type=submit name=vbulletin value='Yorum Yaz'></a><br><br>

                  <script language="javascript">endA()</script>

<div  id="s3l1-ECBAA">

                  <script language="javascript">chkHide('s'+sID);</script>

<form id="form1" name="form1" method="post" action="">

  <table width="355" border="0">

    <tr>

      <td><font size=1>Nick :</font></td>

      <td><label>

        <input name="ad" type="text" id="email" size="21" /></label>

<label><font size=1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Email :</font>

        <input name="email" type="text" id="ad" size="21" value="" />

      </label></td>

    </tr>

    <tr>

      <td><font size=1>Mesaj :</font>

     <td><label>

        <textarea name="mesaj" cols="51" rows="7" id="mesaj"></textarea>

</label></td></td>

    </tr>
<?php
$a = rand(1,9);
$b = rand(1,9);
$sifre = $a+$b; ?>        
                    
<input type="hidden" name="gkodumuz" value="123456">
<input type="hidden" name="zgkod" value="123456">
<input type="hidden" name="sunucu" value="<? echo $sifre; ?>">
<tr>

      <td><font size=1>Security :</font></td>

     <td><label>

<font color="red" size="3"><?  echo ''.$a.'+'.$b;''; ?></font> = <input type="text" maxlength="2" name="kod" class="yazi" size="47" />

</label></td>

    </tr>

    <tr>

      <td>&nbsp;</td>

      <td><input type="submit" name="Submit" value="Gönder" /></td>

    </tr>

  </table>

</form>

<br><b>Not:</b><font color=black>[br] ile Bir Alt Satýra Geçebilirsiniz..HTML Kodlarý Kapalýdýr ve Yorumlar Onaylanýnca Gösterilir..</font>

<?

$ad=htmlspecialchars(addslashes($_POST['ad']));

$email=htmlspecialchars(addslashes($_POST['email']));

$mesaj=htmlspecialchars(addslashes($_POST['mesaj']));

$tarih=date("d.m.Y - H:i:s");

$ip=$_SERVER['REMOTE_ADDR'];

$onay=0;

if($_POST['gkodumuz'] == "123456" && $_POST['zgkod'] == "123456"){ // güvenlik kontrol


if($id && $ad && $email && $mesaj){



if(! eregi('@',$email)){

    echo'<script>alert("Gecerli Bir Email Adres Giriniz..");</script>';

    }elseif(mysql_num_rows(mysql_query("select * from yorumlar where `yazid`='$id' and `mesaj`='$mesaj'"))){





            echo'<br /><div class="mesaj" align=center>&nbsp;&nbsp;Flood Yapma Evlat :) Bu Yorum Kayitli</div>';

        }elseif($_POST['kod'] != $_POST['sunucu']){
echo "<center><br><br>Sistem Onay Kodunuzu Dogrulayamadý!<br/><br/></center>";
}else{      

                $ekle=mysql_query("insert into yorumlar (`yazid`,`ad`,`mail`,`mesaj`,`tarih`,`ip`,`onay`) values ('$id','$ad','$email','$mesaj','$tarih','$ip','$onay')");

                    if($ekle){

                        echo'<script>alert("Yorumunuz Yönetici Tarafindan Incelendikten Sonra Gösterilecektir.."); </script>';

                        }else{

                            echo'<div class="mesaj">&nbsp;&nbsp;<b>sorun olustu.</div></b>';

                            }

            }    

    

    }else{

        } }



?>

</div><td></tr></table>
Visit this user's website Find all posts by this user
Quote this message in a reply
08-17-2011, 06:56 PM
Post: #14
anbu Offline
Naevy LunnyamouR
****
Global Moderators
Posts: 3,297
Joined: Feb 2010
Reputation: 52
RE: Error mysql query & array
Quote:yg jdi permasalhn slnjtnya mash kluar
Code:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in
apa slsh isinya ya om

cona ecute perintah ini manual mau ga?
[codee]select * from yorumlar where 1 `yazid`='$id' and `onay`='1' order by id desc[/code]
Visit this user's website Find all posts by this user
Quote this message in a reply
08-17-2011, 07:06 PM
Post: #15
Emily.Josan♫ Away
*Mod Tercantik*
**
Moderators
Posts: 583
Joined: Jul 2010
Reputation: 168
RE: Error mysql query & array
Thanks semuanya uda bs ... ane apus aja ni script
Code:
`yazid`='$id' and `onay`='1' order by id desc

tapi ane test comment ,,, ga tau masuknya kommen ane kmn?
biarin dah yg pntng uda ga error

skli lagi thanks buat semuannya wawa
Visit this user's website Find all posts by this user
Quote this message in a reply
08-17-2011, 07:32 PM
Post: #16
jomblo1991 Offline
./Devilz Commander
Posts: 264
Joined: Jul 2011
Reputation: 3
RE: Error mysql query & array
Sector Clear! smoke
Find all posts by this user
Quote this message in a reply
« Next Oldest | Next Newest »
Pages (2): « Previous 1 2
Post Reply 


Topic Tools
Topic Link :
BBCode :
HTML Code :
View a Printable Version Send Thread to a Friend Subscribe to this thread
Submit Google Submit Face book Submit to Digg Submit to Reddit Submit to Furl Submit to Del.icio.us Submit to Jeqq

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Buat Database di Mysql petimati 13 6,076 05-11-2013 12:12 PM
Last Post: 201081021-Dennis
  [Tutor] Tipe - Tipe Data yang didukung oleh MySQL RieqyNS13 5 336 05-11-2013 12:00 PM
Last Post: 201081021-Dennis
  [Tutor] Mysql Trigger function view dan stored Porcedure wenkhairu 7 158 05-08-2013 08:57 AM
Last Post: uzumady
  [Ask] error saat menampilkan tabel berdasarkan hubungannya panjul666 7 141 04-05-2013 05:26 PM
Last Post: panjul666
  [Ask] Service mysql bikin Server Lemot mrcuex 11 209 03-07-2013 10:51 AM
Last Post: mrcuex
  Jenis - Jenis Problem Mysql anakbego 5 318 02-28-2013 10:47 PM
Last Post: mrcuex
  Mari mengenal Query SELECT jibril 3 198 10-04-2012 11:36 PM
Last Post: jibril
  Pengin Belajar MySql ( mulai dari mana) G3lombang 15 3,634 09-25-2012 11:02 PM
Last Post: Clound_Ajah
  Facebook Query Language [ FQL ] Emily.Josan♫ 11 810 09-25-2012 02:46 AM
Last Post: 1st_N3iCs
  tutorial mysql qball006_error 13 2,687 06-30-2012 09:40 PM
Last Post: the_critical

Users Browsing
1 Guest(s)

  • Contact Us
  • devilzc0de
  • Return to Top
  • Mobile Version
  • RSS Syndication
  • Help
Current time: 05-22-2013, 10:49 PM Powered By MyBB, © 2002-2013 MyBB Group. Theme created by Justin S. | Mixed By Chaer.Newbie | Fixed By Aditya

USING THIS SITE INDICATES THAT YOU HAVE READ AND ACCEPT OUR TERMS. IF YOU DO NOT ACCEPT THESE TERMS, YOU ARE NOT AUTHORIZED TO USE THIS SITE