Jump to content

can any one tell me is it possible to update query two times


ksumanth

Recommended Posts

Hello friends,

 

I have a form that contains 3fields

1.Title

2.description

3.Image

The problem is while editing(UpdatingImage)

 

While submitting the form i written two queries in updateprocess.php

 

updateprocess.php

if(isset($_POST['submit']))

{

if($image == "")

{

$query1 = "update tblnews_details set heading='$tbl_heading',description='$description' where news_id='$frm_id'";

?>

<script language="javascript">

location.href = "ViewApproveNews.php";

</script>

<?

}

}

?>

Does this answer your question:

 

 

$q="INSERT INTO accounting (`item_name`,

`description`,

`date`,

`cost`,

`sector`

)

VALUES (

'$item_name',

'$description',

'$insert_date',

'$cost',

'$sector'

);";

$sql=mysql_query($q);

 

$record_id=mysql_insert_id();

 

if (!empty($_FILES['img']['tmp_name'])){

// for the main image:

$image = new SimpleImage();

$image->load($_FILES['img']['tmp_name']);

$image->resizeToWidth(600);

$image->save($root.'members/admin/accounting/images/'.$year.'-'.$month.'-'.$day.'_'.$record_id.'.jpg');

$img='members/admin/accounting/images/'.$year.'-'.$month.'-'.$day.'_'.$record_id.'.jpg';

$q="UPDATE `accounting`

SET `img` = '$img'

WHERE `id`='$record_id';";

$sql=mysql_query($q);

}

 

$go='index.php';

header( 'Location: '.$go ) ;

 

?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.