Anachron
New Member
- Reaction score
- 53
MSQL Error.. Mysql fetch object is no valid.. but it does the full action it should?!
Ok the loop ($i) are threads I want to delete.. The question database is a database with questions of the thread ( The threads are surveys ).. I just want to know which syntax I've broken...
The tables:
Threads
id Primary key
name (Varchar)
text (Varchar)
owner (Varchar)
date (Varchar)
ended (bool)
questions
id Primary key
thread (Varchar)
text (Varchar)
Ok the loop ($i) are threads I want to delete.. The question database is a database with questions of the thread ( The threads are surveys ).. I just want to know which syntax I've broken...
The tables:
Threads
id Primary key
name (Varchar)
text (Varchar)
owner (Varchar)
date (Varchar)
ended (bool)
questions
id Primary key
thread (Varchar)
text (Varchar)
PHP:
<?php
echo "Die Befragungen werden gelöscht... <br>";
for ($i=1;$i<=$count;$i++)
{
if ($_POST["lehr_fb_d$i"]!="" and $_POST["lehr_fb_u$i"]!="")
{
$lehr_fb_d=$_POST["lehr_fb_d$i"];
$db_serv="localhost";
$db_table_n="lfb_threads";
$db_dbname="lfb_databases";
$mysql_user_n="root";
$mysql_user_p="";
include ("inc_dbcon.inc.php");
$action="SELECT * FROM ".$db_table_n. " WHERE date='$lehr_fb_d'";
$action_done=mysql_query($action);
while($row=mysql_fetch_object($action_done) )
{
$data_get[0]=$row -> date;
$data_get[1]=$row -> id;
if ($data_get[0]==$lehr_fb_d)
{
$tid=$data_get[1];
$db_serv2="localhost";
$db_table_n2="lfb_questions";
$db_dbname2="lfb_databases";
$mysql_user_n2="root";
$mysql_user_p2="";
$db_handle2=mysql_connect($db_serv2, $mysql_user_n2, $mysql_user_p2);
$db_database2=mysql_select_db($db_dbname2);
$action2="SELECT * FROM ".$db_table_n2." WHERE thread=$tid";
//This line should be infected with no valid resource.. but it still does the whole job $action_done2=mysql_query($action2);
while($row2=mysql_fetch_object($action_done2) )
{
$data_get1[0]=$row2 -> thread;
if ($data_get1[0]==$tid)
{
$action3="DELETE FROM ".$db_table_n2." WHERE thread=$tid";
$action_done2=mysql_query($action3);
}
}
mysql_close($db_handle2);
}
}
mysql_close($db_handle);
$db_serv="localhost";
$db_table_n="lfb_threads";
$db_dbname="lfb_databases";
$mysql_user_n="root";
$mysql_user_p="";
include ("inc_dbcon.inc.php");
$action="DELETE FROM ".$db_table_n." WHERE date='$lehr_fb_d'";
$action_done = mysql_query($action);
mysql_close($db_handle);
}
}
?>