Hello,
iam verynew to php, have some skills in vb and c# so php seems familiar to c# for me.
i would make a listview result for announces. For example car selling announces, you put in which car, wich color, transmission and so on,
then the code make a querry and the viewing of the results should be seltctable, by last entry, by price, should there be 5 / 10 or 20 on every site and if 5 and there are more then five then split into 2 sites.
Thank you very much
Mollet
PS: I only need the part to list the results on different pages if there are more then for example 5 results.
page 1 | 2 | 3 | 4 |
Make a Listview with different criterias
Moderator: General Moderators
- aceconcepts
- DevNet Resident
- Posts: 1424
- Joined: Mon Feb 06, 2006 11:26 am
- Location: London
By "site" i guess you mean page yes?
Depending on the criteria you want to use in your query the typical structure is:
1. Connect to you database
2. Setup your query
If you are using $variables in your WHERE clause then you will want to enter them as:
3. Execute your query
4. Fetch results
You will want to use a loop so you could use:
This is a very basic query but should give you some insight.
Depending on the criteria you want to use in your query the typical structure is:
1. Connect to you database
Code: Select all
$dbLink=mysql_connect ("localhost", "username", "password") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("database_name");Code: Select all
$query="SELECT fields FROM table WHERE conditions";Code: Select all
WHERE field_name1='$variable' AND field_name2='$variable2'Code: Select all
$result=mysql_query($query,$dbLink);You will want to use a loop so you could use:
Code: Select all
while($row=mysql_fetch_array($result))
{
echo $row['field_name']; //THIS WILL OUTPUT THE VALUE FROM THIS FIELD
}- CoderGoblin
- DevNet Resident
- Posts: 1425
- Joined: Tue Mar 16, 2004 10:03 am
- Location: Aachen, Germany