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
https://forums.phpfreaks.com/topic/17134-i-cant-see-nothing-with-these-codes-why/
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]

Archived

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

×
×
  • 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.