Ik had een vraag hoe moet ik dit veranderen


Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /home/bussen1b/public_html/p2000.php on line 10

Notice: Undefined offset: 0 in /home/bussen1b/public_html/p2000.php on line 266

Notice: Undefined variable: straat in /home/bussen1b/public_html/p2000.php on line 266

Notice: Undefined variable: stad in /home/bussen1b/public_html/p2000.php on line 266

Notice: Undefined offset: 0 in /home/bussen1b/public_html/p2000.php on line 266

Notice: Undefined offset: 0 in /home/bussen1b/public_html/p2000.php on line 266

Notice: Undefined variable: straat in /home/bussen1b/public_html/p2000.php on line 266

Notice: Undefined variable: stad in /home/bussen1b/public_html/p2000.php on line 266

Notice: Undefined offset: 0 in /home/bussen1b/public_html/p2000.php on line 266

Notice: Undefined offset: 0 in /home/bussen1b/public_html/p2000.php on line 266

Notice: Undefined variable: straat in /home/bussen1b/public_html/p2000.php on line 266

Notice: Undefined variable: stad in /home/bussen1b/public_html/p2000.php on line 266

Notice: Undefined offset: 0 in /home/bussen1b/public_html/p2000.php on line 266

Notice: Undefined offset: 0 in /home/bussen1b/public_html/p2000.php on line 266

Notice: Undefined variable: straat in /home/bussen1b/public_html/p2000.php on line 266
**knip**

Notice: Undefined variable: stad in /home/bussen1b/public_html/p2000.php on line 266

Notice: Undefined offset: 0 in /home/bussen1b/public_html/p2000.php on line 266

Notice: Undefined offset: 0 in /home/bussen1b/public_html/p2000.php on line 266

Notice: Undefined variable: straat in /home/bussen1b/public_html/p2000.php on line 266

Notice: Undefined variable: stad in /home/bussen1b/public_html/p2000.php on line 266

Notice: Undefined offset: 0 in /home/bussen1b/public_html/p2000.php on line 266

Ik heb ook een sql bestand van google maps gebruikt maar hoe moet ik dat daar in krijgen

[size=xsmall]Toevoeging op 30/12/2015 16:27:09:[/size]

dit is de php code


<?PHP

$tmp = "";

$dbhost = 'xxxx';
$dbuser = 'xxxx';
$dbpass = 'xxxx';
$dbname = 'xxxx';

$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql');
mysql_select_db($dbname);

$query  = "SELECT * FROM alarmeringen ORDER BY timestamp DESC LIMIT 100";
$result = mysql_query($query);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>p2000 monitor bussenentreinenforum.nl</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Cache-Control" content="max-age=3600" />
<meta name="description" content="p2Kflex - Online p2000 meldingen volgen van de hulpdiensten" />
<meta name="keywords" content="p2kflex, FrankiePlankie, supportp2kflex, p2000, monitor, Persinfo, Grip, VOS, VOR, GEA, TIS, VIS, Incidentmeldingen, Veiligheidsregio" />
<meta name="google-site-verification" content="_LmuZ5TTYBjh4XmwcQIy435rVPloxBgVumbQ1-S2jtI" />
<meta name="robots" content="index, nofollow" />
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
<link rel="apple-touch-icon" href="apple-touch-icon.png" />
<link rel="apple-touch-icon" sizes="72x72" href="apple-touch-icon.png" />
<link rel="apple-touch-icon" sizes="114x114" href="apple-touch-icon.png" />
<link rel="apple-touch-icon" sizes="144x144" href="apple-touch-icon.png" />
<link rel="stylesheet" href="p2KflexM.css" type="text/css" />
<meta http-equiv="refresh" content="15" />
<script type="text/javascript" src="script/soundmanager2-nodebug-jsmin.js"></script>
<script type="text/javascript">
soundManager.setup({
  useFlashBlock: false,
  url: "swf/", 
  debugMode: false,
  consoleOnly: false
});
</script><body text="#00FFFF" bgcolor="#000000" link="#33CCFF" vlink="#00FFFF" alink="#00FFFF">
<div id="p2ktooltip"></div>
<script type="text/javascript">
//<![CDATA[ 
var offsetxpoint=-60
var offsetypoint=20
var ie=document.all
var ns6=document.getElementById && !document.all
var enabletip=false
if (ie||ns6)
var tipobj=document.all? document.all["p2ktooltip"] : document.getElementById? document.getElementById("p2ktooltip") : ""
function ietruebody(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}
function p2ktip(thetext, thecolor, thewidth){
	if (ns6||ie){
		if (typeof thewidth!="undefined") tipobj.style.width=thewidth+"px"
		if (typeof thecolor!="undefined" && thecolor!="") tipobj.style.backgroundColor=thecolor
		tipobj.innerHTML = thetext
		enabletip=true
		return false
   }
}
function positiontip(e){
	if (enabletip){
		var curX=(ns6)?e.pageX : event.clientX+ietruebody().scrollLeft;
		var curY=(ns6)?e.pageY : event.clientY+ietruebody().scrollTop;
		var rightedge=ie&&!window.opera? ietruebody().clientWidth-event.clientX-offsetxpoint : window.innerWidth-e.clientX-offsetxpoint-20
		var bottomedge=ie&&!window.opera? ietruebody().clientHeight-event.clientY-offsetypoint : window.innerHeight-e.clientY-offsetypoint-20
		var leftedge=(offsetxpoint<0)? offsetxpoint*(-1) : -1000
		if (rightedge<tipobj.offsetWidth)
		tipobj.style.left=ie? ietruebody().scrollLeft+event.clientX-tipobj.offsetWidth+"px" : window.pageXOffset+e.clientX-tipobj.offsetWidth+"px"
		else if (curX<leftedge)
		tipobj.style.left="5px"
		else
		tipobj.style.left=curX+offsetxpoint+"px"
		if (bottomedge<tipobj.offsetHeight)
		tipobj.style.top=ie? ietruebody().scrollTop+event.clientY-tipobj.offsetHeight-offsetypoint+"px" : window.pageYOffset+e.clientY-tipobj.offsetHeight-offsetypoint+"px"
		else
		tipobj.style.top=curY+offsetypoint+"px"
		tipobj.style.visibility="visible"
	}
}
function hidep2ktip(){
	if (ns6||ie){
		enabletip=false
		tipobj.style.visibility="hidden"
		tipobj.style.left="-1000px"
		tipobj.style.backgroundColor=""
		tipobj.style.width=""
}
}
function ShowMap(data)
{
	var url = 'http://maps.google.nl/maps?f=q&hl=nl&geocode=&q=' + data;
	window.open(url);
}
document.onmousemove=positiontip

var Regio = "0";
var Sound = "0";
var Sid = "vubn0v0vte3lfr3ub3862850g0";
var HtmlData = new Array();
var SysError = 0; var UpdTmr = 1; var Status = ""; Id = 0; 
var adblock = true;

function Load()
{	
	
	Refresh(1);
}
function Refresh(flag) 
{	
	if (document.referrer.indexOf("cloudapp.net") == -1) {
		UpdTmr = UpdTmr - 1;	
		if (UpdTmr == 0) ProcesshttpPost(flag,Regio); 	
		if (UpdTmr < -(15 * SysError)) UpdTmr = 15;																		
		setTimeout('Refresh(0)',1000);	
	} else {
		window.location = "403.html"
	}	
}
function ProcesshttpPost(flag, newregio)
{
	if (flag == 1) {		
		document.getElementById('ad1_inline').appendChild(document.getElementById('ad1_footer'));
		document.getElementById('ad1_footer').style.display = '';
		if (Sound == 0) {
			document.getElementById("audioimg").src = "images/audio_off.png";
		}
	}	
	if (Regio != newregio)	{
		Regio = newregio;
		HtmlData = [];
		window.scrollTo(0, 0);
		Id = 0;
	}
	xmlhttpPost("engine.php?id=" + Id + "&debug=" + Status +  "&regio=" + Regio + "&sid=" + Sid + "&date=" + new Date());	
}
function xmlhttpPost(strURL) {
	
	var xhr; var msg = "";
	Status = "";
	
	if (window.XMLHttpRequest)  {						// Mozilla/Safari	
        xhr = new XMLHttpRequest();				
    }  else if (window.ActiveXObject) {					// IE	
        xhr = new ActiveXObject("Microsoft.XMLHTTP");		
    }		
	xhr.open('GET', strURL, true);	
	xhr.timeout = 10000;	
	xhr.onreadystatechange = function() {
		if (this.readyState == 4) {			
			if (this.status == 200) {
				UpdTmr = 15;
				SysError = 0; 				
				document.getElementById("servererror").style.visibility = "hidden";						
				ProcessData(this.responseText);							
			} else	{								
				SysError = SysError + 1;
				msg = "XMLHttpRequest Status Error (" + this.status + ")";							
			}				
		} else if (this.readyState == 0) {		
			SysError = SysError + 1;
			msg = "XMLHttpRequest ReadyState Error (" + this.readyState + ")";
		} else {
			msg = "XMLHttpRequest ReadyState Error (" + this.readyState + ")";
		}			
		if (SysError > 3) {
			Status = this.readyState + '-' + this.status + '-' + SysError;		
			ShowError(msg); 
		}
		if (SysError > 30) SysError = 30; 
	};			
	xhr.send(null);	
}
function ProcessData(ReceivedData) {

	var tmp = "";
	var i = 0;
	
	if (ReceivedData.length > 0) {
		var data = new Array;
		data = ReceivedData.split('<SplitonThis>');		
		if (data.length > 3) 
		{	
			document.getElementById("phptime").innerHTML = 'Database query : ' + data[2] + ' seconds';	
			if (data[3] != "0")
			{
				document.getElementById("usercount").innerHTML = data[3];
			}			
			if (data.length == 5)
			{
				document.getElementById("sysmessage").innerHTML = data[4];	
				document.getElementById("sysmessage").style.visibility = "visible";		
			}
			else
			{				
				document.getElementById("sysmessage").style.visibility = "hidden";		
			}			
			if (Id < data[1] && Id > 0) 
			{
				if (Sound == 1) 
				{
					PlaySound();					
				}
			}
			Id = data[1];						
			if (data[0] != "") {					
				data.splice(1, data.length - 1);	
				if (HtmlData.length  > 0) 
				{
					data = data.concat(HtmlData);			
				}
				HtmlData = data;						
				if (HtmlData.length > 500)
				{
					HtmlData.splice(500, HtmlData.length - 500);			
				}
				for (i = 0; i < HtmlData.length; i++) 
				{
					tmp = tmp + HtmlData[i];				
				}
				document.getElementById("result").innerHTML =  "<table>" + tmp + "</table>";
			}
		}				
	}		
}
function ToggleSound()
{
	if (Sound == 1) {
		document.getElementById("audioimg").src = "images/audio_off.png";
		Sound = 0;
	} else {		
		document.getElementById("audioimg").src = "images/audio_on.png"; 
		Sound = 1;
	}	
}
function PlaySound(audio)
{	
	var mySound = soundManager.createSound({url: 'sound/beep-7.mp3' , volume: 100});	
	mySound.play();
}				
//]]>
</script>
	<body>
		<table>			
			<tbody>
			<?php				
				while($row = mysql_fetch_array($result, MYSQL_ASSOC))
				{					
					if ($tmp != $row['melding'])
					{						
						if ($tmp != "")
						{
							echo "<tr><td colspan=3><HR></td></tr>";							
						}
						$tmp = $row['melding'];
						preg_match('/[A-Z]+.[0-9]+.[0-9]{4}[A-Z]{2}.:.[A-Z]+/',$row['melding'],$matches);
                        if (count($matches) != 0)
                    {
                        $data = explode(' ',str_replace(':','',$matches[0]));
                        $straat = $data[0];
                        $stad = $data[4]; 
                    }
                        $output = str_replace($matches[0],'<a href ="http://maps.google.nl/maps?f=q&hl=nl&geocode=&q='.$straat.'%20'.$stad.'">'.$matches[0].'</a>',$row['melding']);
						echo '<tr><td class="COL2">' . $row['timestamp'] . '</td><td class="COL4">' . $row['type'] . '</td><td class="COL7G">' . $row['melding'] . '</td></tr>';
					}									
					echo '<tr><tr><td class="COL2"></td><td class="COL1">' . $row['capcode'] . '</td></td><td class="c01">' . $row['label'] . '</td></tr>';	
				}				
			?>
		</table>
		</tbody>		
	</body>
</html>

<?php
mysql_close($conn);
?>
Het antwoord staat in de melding.

Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /home/bussen1b/public_html/p2000.php on line 10

1 regel was wel genoeg.
Notice: Undefined offset: 0 in /home/bussen1b/public_html/p2000.php on line 266

$matches[0] bestaat blijkbaar niet.
$output = str_replace($matches[0],'<a href ="http://maps.google.nl/maps?f=q&hl=nl&geocode=&q='.$straat.'%20'.$stad.'">'.$matches[0].'</a>',$row['melding']);
dat snap ik maar ik heb ook een sql bestand van googlemaps hoe moet ik dat dan doen.
Het gaat over PHP. Dus je SQL-structuur kan je zo laten zoals het is.
Maar hoe moet ik dan de straat en stad dan laten zien in de melding
Misschien handig om eerst maar eens wat te proberen, en te ontdekken wat er gebeurt? ;)
Dan gebeurt er niks ik heb het meerdere keren al geprobeerd maar dat lukte toen niet.
Bij de overstap van MySQL-functies naar MySQLi of PDO verandert er niks aan de manier van weergeven met variabelen. Alleen met het ophalen uit de database.

Als er 'niets' gebeurt, dan zal je wel wat anders vitaals stuk gemaakt hebben in je script.
Zal wel iets zijn die het adres in een link naar Google maakt.

Reageren