Jump to content

is this possible?


eZe616

Recommended Posts

I was wondering if having something like this is possible:

http://localhost/res/index.php?page=viewmore?id=1

 

If so how can you achieve it?

I'm trying to put together real estate site together, now on the index page i'll have the first 5 most recent listings on the home page. Now on the index.php i already have a include script which is as followed

<?php

$page = $_GET['page'];
$page = ($page != '') ? $page : 'home' ;
$page .= '.php';
$page = preg_replace('%(?:\.\./)+%', '', $page);

if (!is_dir($page) && file_exists($page)) {
	if (!(@include($page))) {
		include '404.txt';
	}
}
else {
	echo 'File does not exist';
}
?>  

 

now when the listing are called. I have a link to click "View More", I want it to take the person to a page with more info on the house. would I need a similar script like the inlcuded one on the index to achieve this? Or how can this be done, to get a link like the one above

 

Link to comment
https://forums.phpfreaks.com/topic/51908-is-this-possible/
Share on other sites

Ok, it seems to work, thanks.

Now, let's say I got the ID... How would I get all the info for that 'home' from the mysql table from the ID

 

I have this so far:

$sql = "SELECT * FROM house WHERE id='". $_GET['id'] . "'";

 

but, when I echo it all I get is Resource id#4

 

how do I get all the field associated with that ID?

Link to comment
https://forums.phpfreaks.com/topic/51908-is-this-possible/#findComment-255936
Share on other sites

mysql_query() returns a RESOURCE ID, not the actual rows returned, from a query.  check the manual and you'll see that it mentions this.

 

you need to use an extraction function such as mysql_fetch_array(), mysql_result(), or similar on the resource returned by mysql_query() in order to retrieve the row(s) returned by the query.  have a look in the php manual and you should find some relevant code samples.

Link to comment
https://forums.phpfreaks.com/topic/51908-is-this-possible/#findComment-255961
Share on other sites

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.