<?php
$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
mysql_select_db('mydb');
/* this should return the correct numbers of deleted records */
mysql_query('DELETE FROM mytable WHERE id < 10');
printf("Records deleted: %d\n", mysql_affected_rows());
/* with a where clause that is never true, it should return 0 */
mysql_query('DELETE FROM mytable WHERE 0');
printf("Records deleted: %d\n", mysql_affected_rows());
?>
Shopify, Shopify Apps, Magento, WordPress, Codeigniter, Joomla, Big Commerce | PHP
Showing posts with label Rows. Show all posts
Showing posts with label Rows. Show all posts
Wednesday, 1 July 2015
How to get number of rows affected, While executing mysql query PHP
Friday, 26 June 2015
Inserting multiple rows mysql in codeigniter
if your php version>=5.4 it should work.
You may try thisif ($_POST)
{
$row_ids=$this->input->post('id');
$desc=$this->input->post('desc');
$spaces=$this->input->post('space');
$prices=$this->input->post('price');
$totals=$this->input->post('total');
$data = array();
for ($i = 0; $i < count($this->input->post('id')); $i++)
{
$data[$i] = array(
'row_id' => $row_ids[$i],
'desc' => $desc[$i],
'space' => $spaces[$i],
'price' => $prices[$i],
'total' => $totals[$i],
'code' => time()
);
}
$this->Home_model->create($data);
}
Subscribe to:
Posts (Atom)