Jump to content

I can't see nothing with these codes why?


bilis_money

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]
Link to comment
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]
Link to comment
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.