Jump to content

Recommended Posts

This is my Mysql gen. can anyone tell me why this echos

 

MID(networkset.networkid, 3, 3) AS "MNC" SELECT FROM scan JOIN gps ON scan.gpsid = gps.gpsid JOIN gsmscanset ON scan.scanid = gsmscanset.scanidJOIN gsmcell ON gsmscanset.cellid = gsmcell.cellid WHERE scan.typeid = 4 AND gsmcell.cellid = gsmcell.servingcellid

 

and not

 

SELECT MID(networkset.networkid, 3, 3) AS "MNC" FROM scan JOIN gps ON scan.gpsid = gps.gpsid JOIN gsmscanset ON scan.scanid = gsmscanset.scanidJOIN gsmcell ON gsmscanset.cellid = gsmcell.cellid WHERE scan.typeid = 4 AND gsmcell.cellid = gsmcell.servingcellid

 

heres the code:

 

$arr = array($date,$time,$latandlong,$satdata,$MCC,$MNC,$MCCMNC,$name,$callid,$lac,$bsic,$arfcn,$relvl,$c1,$c2,$rxq,$timing,$numres,$audio,$video,$image);

 

function select($arr){

 

 

foreach ($arr as $key => $value) {

  if (is_null($value)) {

    unset($arr[$key]);

  }

}

$last_item = end($arr);

$last_item = each($arr);

reset($arr);

foreach($arr as $key => $value){

if($value == $last_item['value'] && $key == $last_item['key']){

echo ',';

}

print $value;

}

}

 

//echo '<br>';

 

/* FROM */

$fromdefault1=" scan JOIN gps ON scan.gpsid = gps.gpsid";

$fromdefault2=" JOIN gsmscanset ON scan.scanid = gsmscanset.scanid";

$fromdefault3="JOIN gsmcell ON gsmscanset.cellid = gsmcell.cellid";

/* WHERE */

$wheredefault="scan.typeid = 4 AND

gsmcell.cellid = gsmcell.servingcellid";

if (isset($datebetween, $dateand)){$datesearch=' AND DATE(gps.date) BETWEEN '.$datebetween.' AND '.$dateand.'';}

if (isset($timebetween, $timeand)){$timesearch=' AND DATE(gps.time) BETWEEN '.$timebetween.' AND '.$timeand.'';}

if (isset($timebetween, $timeand)){$timesearch=' AND DATE(gps.time) BETWEEN '.$timebetween.' AND '.$timeand.'';}

if (isset($lat, $long)){$latandlongsearch=' AND DATE(gps.time) BETWEEN '.$lat.' AND '.$long.'';}

 

 

/* Query */

$query = "

SELECT ".select($arr)."

FROM ".$fromdefault1.$namefrom.$fromdefault2.$fromdefault3.$numresform1.$numresform2.$audiofrom.$videofrom.$imagefrom."

WHERE ".$wheredefault.$datesearch.$timesearch.$latandlongsearch . "

";

echo $query;

}

 

Thank you!!!!

Link to comment
https://forums.phpfreaks.com/topic/185485-mysql-gen-help/
Share on other sites

in line

 $query = "    
            SELECT ".select($arr)."
            FROM ".$fromdefault1.$namefrom.$fromdefault2.$fromdefault3.$numresform1.$numresform2.$audiofrom.$videofrom.$imagefrom."
            WHERE ".$wheredefault.$datesearch.$timesearch.$latandlongsearch . "
         "; 

you call function select

it echo some strings and return null

after that concat this (null) in string

in next line script echo this new string

Link to comment
https://forums.phpfreaks.com/topic/185485-mysql-gen-help/#findComment-979307
Share on other sites

in line

 $query = "    
            SELECT ".select($arr)."
            FROM ".$fromdefault1.$namefrom.$fromdefault2.$fromdefault3.$numresform1.$numresform2.$audiofrom.$videofrom.$imagefrom."
            WHERE ".$wheredefault.$datesearch.$timesearch.$latandlongsearch . "
         "; 

you call function select

it echo some strings and return null

after that concat this (null) in string

in next line script echo this new string

 

so how do i fix it?

:)

Link to comment
https://forums.phpfreaks.com/topic/185485-mysql-gen-help/#findComment-981418
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.