ydeonia Posted April 5, 2013 Share Posted April 5, 2013 Hi I have a code like $movie_name = $arrTitle[0]; $arrStr = explode(':',$htmlShowTime); $release = substr($arrStr[3],0,strlen($arrStr[3])-; $director = substr($arrStr[5],0,strlen($arrStr[5])-11); $del_movie = "delete from jos_movie"; mysql_query($del_movie); $del_cinema = "delete from jos_cinema"; mysql_query($del_cinema); $sql = "insert into jos_movie(movie_name,language,cast,movie_release,director)values('$movie_name','null','$cast','$release','$director')"; mysql_query($sql); $sqlCount = 'select max(id) from jos_movie'; $data = mysql_query($sqlCount); $result = mysql_fetch_array($data); $id = $result[0]; //$id = mysql_insert_id(); // find all span tags with class=gb1 foreach($html->find('div.moviTmngBox') as $e){ $tagTitle = $e->find('a',0); $tagTime = $e->find('div.moviTimes',0); $name = $tagTitle->title; $time = $tagTime->innertext; //echo $tagTime->innertext.'<br/>'; $sql = "insert into jos_cinema(cinema_name,show_time,movie_id,logitude,latitude)values('$name','$time',$id,'32.7300','74.8700')"; //echo $sql.'<br/>'; mysql_query($sql); //$arrTem = array($tagTitle->title,$tagTime->innertext); } }//end rss feed loop For now line $sql = "insert into jos_cinema(cinema_name,show_time,movie_id,logitude,latitude)values('$name','$time',$id,'32.7300','74.8700')" I am using hard code values for longitude and latitude . This loop runs for 4 times since there are 4 cinemas. Can you please help me making a condition insert longitude and latitude on the basis of $name (cinema_name) . The longitude and latitude for all 4 cinemas are with me. thanks Quote Link to comment https://forums.phpfreaks.com/topic/276568-condition-help/ Share on other sites More sharing options...
Barand Posted April 5, 2013 Share Posted April 5, 2013 Before you go further I recommend you read this post http://forums.phpfreaks.com/topic/273634-best-way-to-set-up-tables-when-multiple-values/?do=findComment&comment=1408360 Quote Link to comment https://forums.phpfreaks.com/topic/276568-condition-help/#findComment-1423062 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.