Jump to content


Photo

I can't see nothing with these codes why?


  • Please log in to reply
4 replies to this topic

#1 bilis_money

bilis_money
  • Members
  • PipPipPip
  • Advanced Member
  • 621 posts

Posted 10 August 2006 - 02:19 PM

it works but i can't see the results or record?
after the query,

the codes,
<?php
//search record for topic records.
session_start();
require_once ("opendb.php");
require_once ("error_messages.php");
$COerr_msgs = new error_messages; //instantiate object

//get variables from form	
	$topic_new = $_POST['topic']; 
	$_SESSION['topic']=$topic_new;

//select record
	$query  = "SELECT * FROM topics WHERE title='$topic_new'"; //get record from table
	$result = mysql_query($query);
	$chk_dup = mysql_fetch_array($result);

//retrieving old title
	$title_old = $chk_dup[title]; //fetch from table
	$descrip_old = $chk_dup[description];
	$url_old = $chk_dup[url];
	
	
//compare and search new_topic with old_topic using REGEX
	if(preg_match("/\b$topic_new\b/i", $title_old)) {
		//display all data records using paging.
		echo "ok match found!<br>";
		echo $title_old, "<br>";
		echo $descrip_old, "<br>";
		echo $url_old;
	} else {
		$COerr_msgs->err_msgs('search1');	
	}
?>


#2 bilis_money

bilis_money
  • Members
  • PipPipPip
  • Advanced Member
  • 621 posts

Posted 10 August 2006 - 02:21 PM

i'm just wondering if my preg_match() here works fine?

if(preg_match("/\b$topic_new\b/i", $title_old))

specially the insertion of the $topic_new inside preg_match and
$title_old?

any good advice?


GOD bless u for your hep in advance.

#3 king arthur

king arthur
  • Members
  • PipPipPip
  • Advanced Member
  • 335 posts
  • LocationUK HQ

Posted 10 August 2006 - 02:31 PM

Well, what do you see? How do you know it works?
Sir Isaac Newton said "If I have seen farther, it is by standing on the shoulders of giants". But it is not recorded as to whether he said it before or after he was hit on the head by a falling apple.

#4 bilis_money

bilis_money
  • Members
  • PipPipPip
  • Advanced Member
  • 621 posts

Posted 10 August 2006 - 02:35 PM

what i mean works, is i don't see any error.
but after the execution it is showing nothing just PLAIN WHITE WEB PAGE.

no error, no messages, no output result, nothing?

any nice guess from you guys?



#5 hostfreak

hostfreak
  • Members
  • PipPipPip
  • Advanced Member
  • 581 posts

Posted 10 August 2006 - 02:38 PM

Try:

<?php
//search record for topic records.
session_start();
require_once ("opendb.php");
require_once ("error_messages.php");
$COerr_msgs = new error_messages; //instantiate object

//get variables from form	
	$topic_new = $_POST['topic']; 
	$_SESSION['topic']=$topic_new;

//select record
	$query  = "SELECT * FROM topics WHERE title='$topic_new'"; //get record from table
        $result = mysql_query($query) or die(mysql_error());

//retrieving old title
	while ($chk_dup = mysql_fetch_array($result)) { 
	$title_old = $chk_dup["title"]; //fetch from table
	$descrip_old = $chk_dup["description"];
	$url_old = $chk_dup["url"];
	}
	
	
//compare and search new_topic with old_topic using REGEX
	if(preg_match("/\b$topic_new\b/i", $title_old)) {
		//display all data records using paging.
		echo "ok match found!<br>";
		echo $title_old, "<br>";
		echo $descrip_old, "<br>";
		echo $url_old;
	} else {
		$COerr_msgs->err_msgs('search1');	
	}
?>





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users