Current location: Hot Scripts Forums » Programming Languages » PHP » php help PLEASE!!!


php help PLEASE!!!

Reply
  #1 (permalink)  
Old 09-06-11, 06:16 PM
phphelpme phphelpme is offline
Newbie Coder
 
Join Date: Jul 2010
Posts: 85
Thanks: 10
Thanked 0 Times in 0 Posts
php help PLEASE!!!

help
PHP Code:

<?php // members.php

include_once 'header.php';

if (!isset(
$_SESSION['email']))
  die(
"<br /><br /><center>You must be logged in to view this page</center>");
$email $_SESSION['email'];

if (isset(
$_GET['view']))
{
  
$view sanitizeString($_GET['view']);
  
  if (
$view == $email$name "Your";
  else 
$name "$view's";
  
  echo 
"<h3>$name Page</h3>";
  
showProfile($view);
  echo 
"<a href='messages.php?view=$view'>$name Messages</a><br />";
  die(
"<a href='friends.php?view=$view'>$name Friends</a><br />");
}

if (isset(
$_GET['add']))
{
  
$add sanitizeString($_GET['add']);
  
$query "SELECT * FROM friends WHERE email='$add'
        AND friend='
$email'";
  
  if (!
mysql_num_rows(queryMysql($query)))
  {
    
$query "INSERT INTO friends VALUES ('$add', '$email')";
    
queryMysql($query);
  }
}
elseif (isset(
$_GET['remove']))
{
  
$remove sanitizeString($_GET['remove']);
  
$query "DELETE FROM friends WHERE email='$remove'
        AND friend='
$email'";
  
queryMysql($query);
}

$result queryMysql("SELECT first name FROM members ORDER BY email");
$num mysql_num_rows($result);
echo 
"<h3>Other Members</h3><ul>";

for (
$j $j $num ; ++$j)
{
  
$row mysql_fetch_row($result);
  if (
$row[0] == $email) continue;
  
  echo 
"<li><a href='members.php?view=$row[0]'>$row[0]</a>";
  
$query "SELECT * FROM friends WHERE email='$row[0]'
        AND friend='
$email'";
  
$t1 mysql_num_rows(queryMysql($query));
  
  
$query "SELECT * FROM friends WHERE email='$email'
        AND friend='
$row[0]'";
  
$t2 mysql_num_rows(queryMysql($query));
  
$addfriend "add as friend";

  if ((
$t1 $t2) > 1)
  {
    echo 
" &harr; is a mutual friend";
  }
  elseif (
$t1)
  {
    echo 
" &larr; you are following";
  }
  elseif (
$t2)
  {
    
$addfriend "recip";
    echo 
" &rarr; is following you";
  }
  
  if (!
$t1)
  {
    echo 
" [<a href='members.php?add=".$row[0] . "'>$follow</a>]";
  }
  else
  {
    echo 
" [<a href='members.php?remove=".$row[0] . "'>drop</a>]";
  }
}
?>
it keeps saying Unknown column 'first' in 'field list'
please help me here are images
Attached Images
File Type: jpg mainphpmyadmin.jpg (29.8 KB, 85 views)
File Type: jpg friendsphpmyadmin.jpg (28.0 KB, 163 views)
File Type: jpg membersphpmyadmin.jpg (44.3 KB, 83 views)
File Type: jpg messagesphpmyadmin.jpg (33.0 KB, 85 views)
File Type: jpg profilesphpmyadmin.jpg (37.3 KB, 83 views)
Reply With Quote
  #2 (permalink)  
Old 09-07-11, 03:21 AM
kfurlong's Avatar
kfurlong kfurlong is offline
Wannabe Coder
 
Join Date: Oct 2010
Posts: 150
Thanks: 6
Thanked 20 Times in 20 Posts
You need tick marks...

SELECT first name FROM members ORDER BY email

should be

SELECT `first name` FROM members ORDER BY email

because the space is there.
Reply With Quote
The Following User Says Thank You to kfurlong For This Useful Post:
phphelpme (09-12-11)
  #3 (permalink)  
Old 09-08-11, 01:09 PM
aichiche aichiche is offline
New Member
 
Join Date: Sep 2011
Posts: 3
Thanks: 0
Thanked 1 Time in 1 Post
Wink suggestion

one suggestion for you,

never use "field name" , use "field_name"

This is a best practice
Reply With Quote
The Following User Says Thank You to aichiche For This Useful Post:
phphelpme (09-12-11)
  #4 (permalink)  
Old 09-10-11, 05:10 PM
kfurlong's Avatar
kfurlong kfurlong is offline
Wannabe Coder
 
Join Date: Oct 2010
Posts: 150
Thanks: 6
Thanked 20 Times in 20 Posts
P.s. Glad to see you still come around phphelpme XD
Reply With Quote
The Following User Says Thank You to kfurlong For This Useful Post:
phphelpme (09-12-11)
Reply

Bookmarks

Tags
ajax, html, javascript, php, php help


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
2 profitable script sites for sale cms-master.com General Advertisements 3 07-03-07 10:17 AM
PHP Downside--Solutions? Amulet PHP 10 07-15-05 08:26 AM


All times are GMT -5. The time now is 08:49 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.