Sabtu, 24 Agustus 2013

PHP Indonesia - Facebook: #r4bia whats wrong with the query? $query="DELETE...

PHP Indonesia - Facebook
PHP Indonesia is a community for everyone that loves PHP. Our focus is in the PHP world but our topics encompass the entire LAMP stack. Topics include PHP coding, to memcached handling, db optimizations, server stack, web server tuning, code deploying, hosting options and much much more. Youtube Channel : http://www.youtube.com/user/OurPHPIndonesia Twitter : @php_indonesia NOTE: Rules for Wall posting: https://www.facebook.com/groups/35688476100/doc/10151597056316101/ Daftar Keanggotaan : http://www.facebook.com/groups/35688476100/doc/10150671770741101/ 
#r4bia whats wrong with the query? $query="DELETE...
Aug 24th 2013, 12:35, by Black Genies

Black Genies 12:35pm Aug 24
#r4bia
whats wrong with the query?
$query="DELETE FROM $bname WHERE id= $id";

Octafred Yosi Rorimpandei 12:38pm Aug 24
$query="DELETE FROM $bname WHERE id='$id'";

Black Genies 12:46pm Aug 24
still not working

Octafred Yosi Rorimpandei 12:47pm Aug 24
what's the $bname? maybe it's $tbname or something like that

Fariz Yoga Syahputra 12:47pm Aug 24
apa isi dari $bname ?

Fariz Yoga Syahputra 12:47pm Aug 24
setuju sama atas ane

Black Genies 12:48pm Aug 24
<?php
include_once('connect.php');
echo $bname=$_GET['bname'];

$check=mysql_query("SELECT `id` FROM `$bname` WHERE `edate`=''");
$row =mysql_fetch_array($check);
echo $id="id=".$row['id'];
$query="DELETE FROM $bname WHERE id= '$id'";

?>

Fariz Yoga Syahputra 12:49pm Aug 24
hasil echo nya ?

Black Genies 12:49pm Aug 24
the id is echo well...

Octafred Yosi Rorimpandei 12:49pm Aug 24
try like this:

$row =mysql_fetch_array($check);
$id=$row['id'];
$query="DELETE FROM $bname WHERE id= '$id'";
mysql_query($query);

Rizky Ardiansyah 12:51pm Aug 24
^ nice. Black Genies your bug is here... WHERE id = 'id = $row['id']' maybe

Black Genies 12:51pm Aug 24
Fariz Yoga Syahputra i am from pakistan so please ask in english.. thankx

Aris Gates 12:53pm Aug 24
$bname is variable you wrong , must be fields from table in you database

Black Genies 12:54pm Aug 24
^yes its variable containing the table name...

Fariz Yoga Syahputra 12:54pm Aug 24
oh i'm sorry

Ridwan Aji Bari 12:54pm Aug 24
itu ada parameter `edate` nya kali yang gak kebaca. so you must make sure `edate` has a value.

Fariz Yoga Syahputra 12:56pm Aug 24
to run $query string, you have to use mysql_query() function
mysql_query($string);
maybe like that

Agung Bp 12:58pm Aug 24
value $id is "id='that id', so delete bla... bla where id=id='that id'. isn't correct. to check echo your query's

Black Genies 1:05pm Aug 24
$check=mysql_query("SELECT `id` FROM `$bname` WHERE `edate`=''");
$row =mysql_fetch_array($check);
echo $id=$row['id'];
echo $bname=$_GET['bname'];
$query="DELETE FROM $bname WHERE id= '$id'";
mysql_query($query);
the echo values b08/27/2013 and 5

Irvan Firmansyah 1:07pm Aug 24
Use subquery broth !!!
Delete from table where id IN (select from table2 where field = ? )
And the execute ...

Agung Bp 1:09pm Aug 24
just echo $query & paste in here the query's echo

Black Genies 1:11pm Aug 24
didnt get u ^

Wahyu Primadi 1:12pm Aug 24
Change with this: $query="DELETE FROM `".$bname."` WHERE id='".$id."'";

Irvan Firmansyah 1:13pm Aug 24
Your id condition contain array structure/ have more value...so use sub query

Wahyu Primadi 1:15pm Aug 24
The problem is ur query contains "/" chars, that u must use ` char in front and back of variable of field name: ... FROM `$bname` WHERE ... like that, got it?

Black Genies 1:16pm Aug 24
$query="DELETE FROM `".$bname."` WHERE id='".$id."'";
thnkx.this query works :)

You are receiving this email because you subscribed to this feed at blogtrottr.com.

If you no longer wish to receive these emails, you can unsubscribe from this feed, or manage all your subscriptions

Tidak ada komentar:

Posting Komentar