Pages: [1]   Go Down
Send this topic | Print
Author Topic: how can you load this for mysql <update> still needs help  (Read 128 times)
chase
Member
*
Offline Offline

Posts: 22


« on: September 25, 2009, 06:28:26 PM »

can some make a simple search simple for this script and make it load random profiles to can some one help me with this,please

i pretty much would like it to search for age,gender,IM Type and country
but i dont have a clue how do seeing im not that good with php or mysql

here the script i found on the net

Code:
 <table border="1"  bordercolor="#000000">
    <tr>
      <td>&nbsp;
     <form action="listprofile.php" method="GET" enctype="multipart/form-data">

IM Type&nbsp;<select name="imtype" size="1">
<option value="msn" selected="selected">msn</option>
<option value="icq">icq</option>
<option value="aim">aim</option>

</select>&nbsp;
      Gender&nbsp;<select name="gender" size="1">
<option value="male">male</option>
<option value="female">female</option>
</select>&nbsp;
      Age&nbsp;<input name="age" size="1" maxlength="2" value="">&nbsp;
      Country&nbsp;<input name="country" size="20" value="">&nbsp;
      <input type="submit" name="submit" value="Search">
      </form>
      </td>
    </tr>
  </table>

  <?
   ?>
<?php
include("conn.php");
$pagename="listprofile";

$max = 5; //amount of articles per page. change to what to want
$p = $_GET['p'];
if(empty(
$p))
{
$p = 1;
}
$limits = ($p - 1) * $max;
//view the news article!
if(isset($_GET['act']) && $_GET['act'] == "view")
{
$id = $_GET['id'];
$genderid  = $_GET['genderID'];
$sql = mysql_query("SELECT * FROM listprofile2 WHERE postID = '$id'");
while(
$r = mysql_fetch_array($sql))
{

$name = $r['name'];
$age =  $r['age'];
$gender = $r['gender'];
$cam   = $r['cam'];
$mic    = $r['mic'];
$looking  = $r['looking'];
$imtype = $r['imtype'];
$im = $r['im'];
$images1 =$r['images1'];
$images2 = $r['images2'];
$images3 = $r['images3'];
$images4 = $r['images4'];
$text  = $r['text'];
echo
"<div><p>$name </p><p><img src=\"$images1\" width=\"120\" height=\"150\"></p><p>$linkurl</p></div>";
}

}else{

//view all the news articles in rows
$sql = mysql_query("SELECT * FROM listprofile2 LIMIT ".$limits.",$max") or die(mysql_error());
//the total rows in the table
$totalres = mysql_result(mysql_query("SELECT COUNT(postID) AS tot FROM listprofile2"),0);
//the total number of pages (calculated result), math stuff...
$totalpages = ceil($totalres / $max);
//the table
while($r = mysql_fetch_array($sql))
{



$id = $r['postID'];
$username = $r['name'];
$linkurl  = $r['text'];
echo
"<a href='$pagename.php?act=view&id=$id&gender=$gender1&imtype=$imtype1&age=$age1&country=$country1'>$username</a><br />";
}
for(
$i = 1; $i <= $totalpages; $i++){
//this is the pagination link
echo "<a href='$pagename.php?p=$i&gender=$gender1&imtype=$imtype1&age=$age1&country=$country1'>$i</a>|";
}
}

?>



mysql
Code:
-- phpMyAdmin SQL Dump
-- version 2.9.1.1
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Sep 25, 2009 at 05:35 AM
-- Server version: 5.0.27
-- PHP Version: 4.4.4
--
-- Database: `cool`
--

-- --------------------------------------------------------

--
-- Table structure for table `listprofile2`
--

CREATE TABLE `listprofile2` (
  `postID` int(10) NOT NULL auto_increment,
  `gender` text,
  `country` text,
  `text` text,
  `images1` text,
  `images2` text,
  `images3` text,
  `images4` text,
  `cam` text,
  `mic` text,
  `looking` varchar(255) default NULL,
  `imtype` text,
  `age` text,
  `Im` text,
  `name` text,
  PRIMARY KEY  (`postID`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=13 ;

--
-- Dumping data for table `listprofile2`
--

INSERT INTO `listprofile2` (`postID`, `gender`, `country`, `text`, `images1`, `images2`, `images3`, `images4`, `cam`, `mic`, `looking`, `imtype`, `age`, `Im`, `name`) VALUES
(1, 'female', 'canada', 'im a sexy hot chick looking to get down for a fun wild night on webcam,', 'user/girl.jpg', 'user/girl.jpg', 'user/girl.jpg', 'user/girl.jpg', 'yes', 'no', 'sex', 'msn', '24', 'sexygirl[ @ ] yahoo.ca', 'name1'),
(2, 'female', 'la', 'this is just a test to see if it all works  out fine  ', 'user/girl.jpg', 'user/girl.jpg', 'user/girl.jpg', 'user/girl.jpg', 'yes', 'no', 'cyber cat', 'msn', '22', 'you@msn.com', 'jill'),
(3, 'female', 'la', 'this is just a test to see if it all works  out fine  ', 'user/girl.jpg', 'user/girl.jpg', 'user/girl.jpg', 'user/girl.jpg', 'yes', 'no', 'cyber cat', 'msn', '22', 'you@msn.com', 'katey'),
(4, 'female', 'la', 'this is just a test to see if it all works  out fine  ', 'user/girl.jpg', 'user/girl.jpg', 'user/girl.jpg', 'user/girl.jpg', 'yes', 'no', 'cyber cat', 'live', '19', 'you@msn.com', 'Kate'),
(5, 'male', 'ny', 'this is just a test to see if it all works  out fine  ', 'user/girl.jpg', 'user/girl.jpg', 'user/girl.jpg', 'user/girl.jpg', 'yes', 'no', 'cyber cat', '0', '22', 'you@msn.com', 'pee'),
(6, 'male', 'ny', 'this is just a test to see if it all works  out fine  ', 'user/girl.jpg', 'user/girl.jpg', 'user/girl.jpg', 'user/girl.jpg', 'yes', 'no', 'cyber cat', '0', '22', 'you@msn.com', 'patty'),
(7, 'male', 'la', 'this is just a test to see if it all works  out fine  ', 'user/girl.jpg', 'user/girl.jpg', 'user/girl.jpg', 'user/girl.jpg', 'yes', 'no', 'cyber cat', '0', '22', 'you@msn.com', 'name3'),
(8, 'female', 'la', 'this is just a test to see if it all works  out fine  ', 'user/girl.jpg', 'user/girl.jpg', 'user/girl.jpg', 'user/girl.jpg', 'yes', 'no', 'cyber cat', '0', '22', 'you@msn.com', 'name2'),
(9, 'female', 'la', 'this is just a test to see if it all works  out fine  ', 'user/girl.jpg', 'user/girl.jpg', 'user/girl.jpg', 'user/girl.jpg', 'yes', 'no', 'cyber cat', '0', '22', 'you@msn.com', 'kelly'),
(10, 'female', 'canada', 'this is just a test to see if it all works  out fine  ', 'user/girl.jpg', 'user/girl.jpg', 'user/girl.jpg', 'user/girl.jpg', 'yes', 'no', 'cyber cat', '0', '22', 'you@msn.com', 'name4'),
(11, 'male', 'canada', 'this is just a test to see if it all works  out fine  ', 'user/girl.jpg', 'user/girl.jpg', 'user/girl.jpg', 'user/girl.jpg', 'yes', 'no', 'cyber cat', '0', '22', 'you@msn.com', 'name6'),
(12, 'female', 'canada', 'this is just a test to see if it all works  out fine  ', 'user/girl.jpg', 'user/girl.jpg', 'user/girl.jpg', 'user/girl.jpg', 'yes', 'no', 'cyber cat', '0', '22', 'marryyou@msn.com', 'marry');
/code]
« Last Edit: September 25, 2009, 06:44:36 PM by chase » Logged
Pages: [1]   Go Up
Send this topic | Print
Jump to: