Jump to content

Archived

This topic is now archived and is closed to further replies.

bilis_money

I can't see nothing with these codes why?

Recommended Posts

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

the codes,
[code]
<?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');
}
?>
[/code]

Share this post


Link to post
Share on other sites
i'm just wondering if my preg_match() here works fine?

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

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

any good advice?


GOD bless u for your hep in advance.

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
Try:

[code]
<?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');
}
?>
[/code]

Share this post


Link to post
Share on other sites

×

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.