Jump to content

jsoeurt

New Members
  • Posts

    9
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

jsoeurt's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hello, I'm working on a website where a user can add their hobbies/interests to their profile. I want them to choose from a list so I can keep the sicko stuff out of the database and to make finding users with things in common easier. I was thinking about a triple drop down box, something like: http://www.trans4mind.com/personal_.../tripleMenu.htm What's your opinion on this? Does anyone know of a website where I can see something like this? Compiling a list myself will take millions of years and would be stupid if it already exists.
  2. Maybe someone has experience with dating sites? I think they use the same idea..
  3. Use this code at the beginning of every page: <?php // like i said, we must never forget to start the session session_start(); // is the one accessing this page logged in or not? if (!isset($_SESSION['db_is_logged_in']) || $_SESSION['db_is_logged_in'] !== true) { // not logged in, move to login page header('Location: login.php'); exit; } ?> When the users logs in $_SESSION['db_is_logged_in'] has to be set to true and when he log out it has to be set to false.
  4. I've got a database with users and the things they are interested in. The database contains the following fields: username, interested1, interested2, interested3 User1 for example is interested in "rock music", "dvd movies with a happy ending" and "going on vacation" Now I want to show User1 the username of a user that has things in common with User1. But I don't want it to be the same result every single time. And when there are no users with things in common I want to show a random username. Does anyone know how to do this?
  5. Hello, I'm using nrsTable ( http://nrstable.sourceforge.net/ ) to show messages for the user that is logged on. The messages are stored in a mysql database. I've got a little problem with putting the data in the 2-dimensional arrays for nrsTable. This is what I've got so far: <script language="JavaScript" src="natcompare.js"></script> <script language="JavaScript" src="nrs_table.js"></script> <table border=0 cellspacing=5 cellpadding=5> <tr> <td> <table id="inbox" border=0 cellspacing=0 cellpadding=0 width="550"></table> </td> </tr> </table> <script language="JavaScript"> var header = new Array("From", "Subject", "Writo-count"); var data = new Array( <?php $id=$_SESSION['id']; mysql_connect("localhost", "XXXXXXXXXX", "XXXXXXXXX") or die(mysql_error()); mysql_select_db("xxxxxxx") or die(mysql_error()); $query = "SELECT * FROM messages WHERE `to` = $id"; $result = mysql_query($query)or die ( mysql_error( ) ); while($record = mysql_fetch_object($result)){ $from=$record->from; $subject=$record->subject; $counter=$record->counter; $msg_id=$record->id; echo "new Array ( \"$from\", \"$subject\", \"$counter\"),"; } mysql_close($conn); ?> new Array ( "---------", "---------", "---------") ); var links = new Array( "alert('Row1');", "alert('Row2');", "alert('Row3');", "alert('Row4');", "alert('Row5');", "alert('Row6');", "alert('Row7');", "alert('Row8');", "alert('Row9');", "alert('Row10');" ); nrsTable.setup( { table_name: "inbox", table_header: header, table_data: data, row_links: links, foot_headers: true, up_icon: "img/up.gif", down_icon: "img/down.gif", prev_icon: "img/left.gif", next_icon: "img/right.gif", rew_icon: "img/first.gif", fwd_icon: "img/last.gif", header_color: "#53c2f4", footer_color: "#53c2f4", even_cell_color: "#b9b9ac", odd_cell_color: "#d4fbf6", hover_color: "#ccff99", natural_compare: true, page_nav: true, rows_per_page: 10, padding: 3, natural_compare: true, disable_sorting: new Array(1,3) } ); </script> It shows the user a nice list of messages available but I also want to add a value to the link-array. So if you click the first message-subject it opens up a link like this "readmessage?msg_id=$msg_id" instead of doing an alert("row1");. Also I know that the way I'm filling the array right now isn't very pretty. thanks.
  6. Thanks. I guess the quotes were the problem.
  7. If you want to get the value of $_SESSION['cart'] and store it in $cart you'll have to do it the other way around: <?php $cart = $_SESSION['cart']; ?>
  8. I got this: SELECT * FROM 'messages' WHERE 'to' = 11You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''messages' WHERE 'to' = 11' at line 1 So I guess there's something wrong with the sql as well.
  9. Hello, I've been trying to fix this for hours. I simply don't know what I'm doing wrong. I'm trying to get all the messages that are waiting for a certain userid from a MySQL database. <?php $id=$_SESSION['id']; mysql_connect("localhost", "XXXXXXXX", "XXXXXXXXXXX") or die(mysql_error()); mysql_select_db("XXXXXXXXXXX") or die(mysql_error()); $query = "SELECT * FROM 'messages' WHERE 'to' = $id"; echo $query; $result = mysql_query($query)or die ( mysql_error( ) ); while($record = mysql_fetch_object($query)){ echo ".$record->from."<br>"; echo ".$record->subject."<br>"; echo ".$record->counter."<br>"; } mysql_close($conn); ?> And this is the database... -- phpMyAdmin SQL Dump -- version 2.9.2-Debian-1.one.com6 -- http://www.phpmyadmin.net -- -- Host: localhost -- Generation Time: Dec 07, 2007 at 05:04 PM -- Server version: 5.0.32 -- PHP Version: 5.2.5 -- -- Database: `XXXXXXXXX` -- -- -------------------------------------------------------- -- -- Table structure for table `messages` -- CREATE TABLE `messages` ( `id` int(11) NOT NULL auto_increment, `from` int(11) NOT NULL, `to` int(11) NOT NULL, `subject` text NOT NULL, `body` text NOT NULL, `counter` int(11) NOT NULL, PRIMARY KEY (`id`), KEY `to` (`to`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='Messages' AUTO_INCREMENT=4 ; -- -- Dumping data for table `messages` -- INSERT INTO `messages` VALUES (1, 12, 11, 'test2', 'lalala', 1); INSERT INTO `messages` VALUES (3, 14, 11, 'test4', 'adfjadhajdh', 1); It's probably something stupid...
×
×
  • 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.