foreach($_POST['delbox'] as $k=>$v)
{
$count++;
$result = mysql_query("SELECT * FROM query WHERE id=".$k);
while($row = mysql_fetch_array($result))
{
$data="insert into trash (id, name) VALUES('$row['id']', '$row['name']')";
mysql_query($data);
}
}
check the error in code (insert into table values)
Moderator: General Moderators
-
mianmajidali
- Forum Commoner
- Posts: 30
- Joined: Tue Dec 01, 2009 8:05 pm
- AbraCadaver
- DevNet Master
- Posts: 2572
- Joined: Mon Feb 24, 2003 10:12 am
- Location: The Republic of Texas
- Contact:
Re: check the error in code (insert into table values)
What error?
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
-
mianmajidali
- Forum Commoner
- Posts: 30
- Joined: Tue Dec 01, 2009 8:05 pm
Re: check the error in code (insert into table values)
can u remove the error in my code plz ??
-
mianmajidali
- Forum Commoner
- Posts: 30
- Joined: Tue Dec 01, 2009 8:05 pm
Re: check the error in code (insert into table values)
hi to all,
i m trying to copy data from one table to another table in same database. by this code.
-------------------------------
foreach($_POST['delbox'] as $k=>$v)
{
$count++;
$result = mysql_query("SELECT * FROM query WHERE id=".$k);
while($row = mysql_fetch_array($result))
{
$data="insert into trash (id, name) VALUES('$row['id']','$row['name']')";
mysql_query("$data");
}
//mysql_query("delete from query where id=".$k);
}
------------------
when i execute this file, it generates the following error
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home3/oscobizz/public_html/new/data.php on line 19
This is Line 19
$data="insert into trash (id, name) VALUES('$row['id']','$row['name']')";
--------------------------------------------------------
Please check and correct the error.
thanks
i m trying to copy data from one table to another table in same database. by this code.
-------------------------------
foreach($_POST['delbox'] as $k=>$v)
{
$count++;
$result = mysql_query("SELECT * FROM query WHERE id=".$k);
while($row = mysql_fetch_array($result))
{
$data="insert into trash (id, name) VALUES('$row['id']','$row['name']')";
mysql_query("$data");
}
//mysql_query("delete from query where id=".$k);
}
------------------
when i execute this file, it generates the following error
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home3/oscobizz/public_html/new/data.php on line 19
This is Line 19
$data="insert into trash (id, name) VALUES('$row['id']','$row['name']')";
--------------------------------------------------------
Please check and correct the error.
thanks
- AbraCadaver
- DevNet Master
- Posts: 2572
- Joined: Mon Feb 24, 2003 10:12 am
- Location: The Republic of Texas
- Contact:
Re: check the error in code (insert into table values)
All the answers: http://us2.php.net/manual/en/language.types.string.php
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.