Ik heb de volgende SQL:

<?php
$ophalen = mysql_query("SELECT SUBSTRING(post_text FROM 1 FOR 10), post_id FROM phpbb_posts_text ORDER BY post_id DESC LIMIT 0, 10") OR DIE(mysql_error());
?>


Helaas krijg ik niks geprint van de post_text column. Tuurlijk gaat de post_id column wel zonder foutjes. Ik krijg o.a de volgende errors:


Notice: Undefined index: post_text in /home/firstdrop/domains/firstdrop.nl/public_html/includes/lforummessage.php on line 29


En dat nog 10x zo door. Regel 29 is dit:

<?php
echo "<a href=\"http://www.firstdrop.nl/forum/viewtopic.php?p=".$row['post_id']."#".$row['post_id']."\">".$row['post_text']."</a><br />"; 
?>


En mijn gehele script:

<?php
error_reporting(E_ALL);

//Made by Remy

//Last Forum Message (PHPbb)


if (!mysql_select_db("*****", mysql_connect("******", "*****", "******"))) 
 { 
   echo "Er kon geen connectie worden gemaakt met de database."; 
   include 'inc_footer.php';
   exit; 
 }

$ophalen = mysql_query("SELECT SUBSTRING(post_text FROM 1 FOR 10), post_id FROM phpbb_posts_text ORDER BY post_id DESC LIMIT 0, 10") OR DIE(mysql_error());

while($row = mysql_fetch_array($ophalen))
  {
	$sqll = mysql_query("SELECT forum_id FROM phpbb_posts WHERE post_id = ".$row['post_id']." LIMIT 1") OR DIE(mysql_error());
	while($controle = mysql_fetch_array($sqll))
	  {
		if($controle['forum_id'] == "2")
		  {
			//DAN SLAAT HIJ HEM OVER!
	          }
		else
		  {
			echo "<a href=\"http://www.firstdrop.nl/forum/viewtopic.php?p=".$row['post_id']."#".$row['post_id']."\">".$row['post_text']."</a><br />";
		  }
	  }
  }



?>


Iemand? Alvast bedankt! :)

<?php

include 'besturing.php';

$user_id = isset($_GET['user_id']) && ctype_digit($_GET['user_id']) ? $_GET['user_id'] : false;
$stijlicoon_id = isset($_GET['stijlicoon_id']) && ctype_digit($_GET['stijlicoon_id']) ? $_GET['stijlicoon_id'] : false;

if($user_id && $stijlicoon_id)
  {
	$sql = mysql_query("SELECT id FROM Stijliconen WHERE stijlicoon_id = '".$stijlicoon_id."' AND user_id = '".$user_id."' LIMIT 1") OR DIE(mysql_error());

	if(mysql_num_rows($sql) == 1)
	  {
		echo "Je hebt deze persoon al toegevoegd als stijlicoon!";
		exit;
	  }

	$query = "SELECT Gebruikersnaam FROM Leden WHERE ID = '".$user_id."' LIMIT 1";

	if(!$result = mysql_query($query))
	  {
		echo "Error: Kan naam uit Leden niet ophalen.";
		exit;
	  }
	
	$naamrow = mysql_fetch_assoc($result);

	$onderwerp = $naamrow['Gebruikersnaam']." heeft jou toegevoegd als stijlicoon!";

	$bericht = "Gefeliciteerd!<br /><br />".$naamrow['Gebruikersnaam']." heeft je toegevoegd als stijlicoon!";

	$berichten = "INSERT INTO LedenBerichten (ID, Van, Datum, Onderwerp, Bericht)
		VALUES ('".$user_id."', '".$stijlicoon_id."', '".time()."', '".$onderwerp."', '".$bericht."')";

	if(!$error = mysql_query($berichten))
	  {
		echo "Error: Kan bericht niet versturen.";
		exit;
	  }

	$addstijlicoon = "INSERT INTO Stijliconen (stijlicoon_id, user_id)
			VALUES ('".$stijlicoon_id."', '".$user_id."')";

	if(!$adderror = mysql_query($addstijlicoon))
	  {
		echo "Error: Kan stijlicoon niet toevoegen.";
		exit;
	  }
	else
	  {
		echo "Je hebt succesvol een stijlicoon toegevoegt!";
		exit;
	  }

 }
else
 {
	echo "Error: Er is geen GET waarde of de GET waarde's zijn geen integers.";
	exit;
 }
?>
Ter aanvulling je $var post_text bestaat niet.
waarchijnlijk typefoute ofo

Reageren