Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,165,889 members, 7,863,042 topics. Date: Monday, 17 June 2024 at 10:49 AM

Php Mysql Help - Webmasters - Nairaland

Nairaland Forum / Science/Technology / Webmasters / Php Mysql Help (527 Views)

Php/mysql Pin And Serial Number Generation Script / Wamp Server Ebook Ft Install Wamp, Write Php / Mysql / Mysql Console / Learn Cakephp, Php/mysql For Free With Video Tutorials (2) (3) (4)

(1) (Reply)

Php Mysql Help by guru01(m): 7:34pm On Feb 08, 2012
Hello,
i tried to read out data from a specific date from mysql database.
What i wanted is for php to get all the data from the database within a specific date i enter, but it seems that the script just get only the first role of data and leave out the rest.
Pls can i get a code that can achieve this.
Re: Php Mysql Help by guru01(m): 8:10pm On Feb 08, 2012
<?php
if(isset($_REQUEST['query']))
{
$searchQuery = $_POST['data-search'];

//connceting to db
$con = mysql_connect($_SERVER['SERVER_NAME'],'root','');
if(!$con)
{
die("Error connecting: ".mysql_error());
exit;
}
//selecting db
$dbSelect = mysql_select_db("directory",$con);
$query = "SELECT * FROM websites WHERE Date LIKE '$searchQuery'";
//executing query
$result = mysql_query($query,$con);
if(!$result)
{
die("Could not connect: ".mysql_error());
}
while($row = mysql_fetch_array($result))
{
$searchOutput = "<html><body><table border=1><tr><td>Website Title</td><td>Website URL</td><td>About Website Content</td></tr>
<tr><td>".$row['Title']."</td><td>".$row['URL']."</td><td>".$row['Content']."</td></tr></table>";
}
$searchSuccess = "<p>Your Search was successful</p</body></html>";
mysql_close($con);
echo $searchOutput;
echo $searchSuccess;

}
else{
echo "Invalid";
}

?>

(1) (Reply)

Get Your Own Company/personal Cool And Creative Website! / Computer Trainer Wanted For Immediate Employment / You Can Nevertheless Uncover Mulberry Handbags

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 7
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.