PHP - Random Member Avatars, Need Help With Table
Hi
My knowledge about this stuff is less than basic, I am using this code which I found, changed it little bit with help of logic as original one was not working and make it work but.... I would like to place frames around avatars while avatars are in horizontal order one next to each other...and under them there is nick names
So all this is done on Vbulletin board, within one custom widget
This is my code now, what I need is frames and that nick names are centered :
$member_count = 6; ob_start(); require_once('./includes/functions_user.php'); require_once('./includes/functions_bigthree.php'); // Get Random Members $newusers_get = vB::$db->query_read(" SELECT ".TABLE_PREFIX."user.userid AS userid, ".TABLE_PREFIX."user.username AS username, ".TABLE_PREFIX."user.avatarrevision AS avatarrevision, ".TABLE_PREFIX."customavatar.dateline AS dateline FROM ".TABLE_PREFIX."customavatar LEFT JOIN ".TABLE_PREFIX."user ON ".TABLE_PREFIX."customavatar.userid=".TABLE_PREFIX."user.userid WHERE ".TABLE_PREFIX."customavatar.visible = 1 ORDER BY RAND() LIMIT $member_count"); $output_bits = '<table cellpadding="5" align="center"><tr>'; while($newuser = vB::$db->fetch_array($newusers_get)) { $output_bits .= '<td><a href="member.php?u='.$newuser[userid].'"><img src="image.php?u='.$newuser[userid].'&dateline='.$newuser[dateline].'" alt="'.$newuser[username].'"/ width="120" height="120"><br />'.$newuser[username].'</a></td>'; } $output_bits .= '</tr></table>'; $output = $output_bits; ob_end_clean();And in attached photo you can see how it looks At least point me in a right direction, not sure what tor read or where to look Thank you Goran Attached Files Untitled 0111.jpg 29.24KB 0 downloads Similar Tutorialshi i have beeen trying for awhile now to get this code working but with no joy. For after you make a comment username and avatar of the person that made the comment doesn't show. Can anyone help me on this thanks. Code: [Select] <div id="center"> <div class="container_box1"> <div id="headergames2">Profile</div> <?php if(!isset($_SESSION["user"])) { echo '<center><span style="font-size:150%;text-align:center;">You must Register or log in to view member profiles.</span></center>'; } else { if(isset($_POST['addcomment'])) { if(empty($_POST['userid'])) { echo 'Sorry, the member you were commenting seems to be invalid.'; } elseif (empty($_POST['comment']) || empty($_POST['name'])) { echo 'Please go back and try again, it seems the comment or name was left empty.'; } else { $userid = yasDB_clean($_POST['userid']); $comment = yasDB_clean($_POST['comment'],true); $name = yasDB_clean($_POST['name']); $ipaddress = $_SERVER['REMOTE_ADDR']; yasDB_insert("INSERT INTO `memberscomments` (id,userid, comment, ipaddress, name) values ('', '{$userid}', '{$comment}', '{$ipaddress}', '{$name}')",false); echo '<span style="color:red;">Comment added!</span>'; } } $id = yasDB_clean($_GET['id']); $query = yasDB_select("SELECT * FROM `user` WHERE id = '$id'"); $row = $query->fetch_array(MYSQLI_ASSOC);$query->close(); $joined = date('m/d/y',$row['date']); $points = $row['plays']*50; if ( $row['website'] != '') { $website = '<a href="'.$row['website'].'" target="_blank">Website</a><br>'; } else { $website = 'No Website'; }; if ( $row['location'] != '') { $location = ''. $row['location'].'<br>'; } else { $location = 'Place where you stay.<br>'; }; if ( $row['job'] != '') { $occupation = ''. $row['job'].'<br>'; } else { $occupation = 'Work place.<br>'; }; if ( $row['useavatar'] == '1' ) { $avatarimage = $setting['siteurl'] . 'avatars/' . $row['avatarfile']; }else { $avatarimage = $setting['siteurl'] . 'avatars/useruploads/noavatar.JPG'; } if ($setting['seo'] == 'yes') { $membersprofile = $setting['siteurl'].'profile.html'; } else { $membersprofile = $setting['siteurl'].'index.php?act=profile'; } ?> <div class="containbox2"> <div class="profile"> <ul> <li class="title">Username: <?php echo $row['username'];?></li> <li class="profilepic"><img src="<?php echo $avatarimage;?>" width="130" height="100"> <br/> <a href="<?php echo $membersprofile;?>">Edit Profile</a> <hr><?php echo $website;?><hr> </li> </ul> <ul> <li class="title2">About Me</li> <li class="aboutme"><?php echo $row['aboutme'];?></li> </ul> </div> <div class="clear"></div> <div class="profile2"> <ul> <li class="info2">Location:</li> <li class="info2">Joined:</li> <li class="info2">Plays:</li> <li class="info2">Points:</li> <li class="info2">Occupation:</li> </ul> <ul> <li class="info"><?php echo $location;?></li> <li class="info"><?php echo $joined;?></li> <li class="info"><?php echo $row['plays'];?></li> <li class="info"><?php echo $points;?></li> <li class="info"><?php echo $occupation;?></li> </ul> <ul> <li class="info2">AIM:</li> <li class="info2">MSN:</li> <li class="info2">Skype:</li> <li class="info2">Yahoo:</li> </ul> <ul> <li class="info"><?php echo $row['aim'];?></li> <li class="info"><?php echo $row['msn'];?></li> <li class="info"><?php echo $row['skype'];?></li> <li class="info"><?php echo $row['yahoo'];?></li> </ul> </div> </div> <div class="clear"></div> </div> <div class="container_box1"><div id="headergames2">Member's Comments:</div> <div class="containbox2"> <div id="messages"> <?php $query = yasDB_select("SELECT * FROM memberscomments"); $query2 = yasDB_select("SELECT * FROM user"); $prefix = $setting['siteurl'] . 'templates/' . $setting['theme'] . '/skins/' . $setting['skin'] . '/images/smileys/'; if($query->num_rows == 0) { ?> <div class="container_box5">This member has no comments, be the first to add one!</div> <?php } else { $query = yasDB_select("SELECT *,DATE_FORMAT(`timestamp`,'%b %e, %y, %r') AS formatted_time FROM memberscomments WHERE `userid`=`id` ORDER BY `id` DESC LIMIT 5"); $row = $query->fetch_array(MYSQLI_ASSOC); $query2 = yasDB_select("SELECT `username`, `useavatar`, `avatarfile` FROM `user` WHERE `username` = '{$row['name']}'"); $row2 = $query2->fetch_array(MYSQLI_ASSOC); $text = $row['comment']; $text = str_replace(':D','<img src="' . $setting['siteurl'].'templates/'.$setting['theme'].'/skins/'.$setting['skin'].'/images/smileys/biggrin.gif" title="biggrin" alt="biggrin" />',$text); $text = str_replace(':?','<img src="' . $setting['siteurl'].'templates/'.$setting['theme'].'/skins/'.$setting['skin'].'/images/smileys/confused.gif" title="confused" alt="confused" />',$text); $text = str_replace('8)','<img src="' . $setting['siteurl'].'templates/'.$setting['theme'].'/skins/'.$setting['skin'].'/images/smileys/cool.gif" title="cool" alt="cool" />',$text); $text = str_replace(':cry:','<img src="' . $setting['siteurl'].'templates/'.$setting['theme'].'/skins/'.$setting['skin'].'/images/smileys/cry.gif" title="cry" alt="cry" />',$text); $text = str_replace(':shock:','<img src="' . $setting['siteurl'].'templates/'.$setting['theme'].'/skins/'.$setting['skin'].'/images/smileys/eek.gif" title="eek" alt="eek" />',$text); $text = str_replace(':evil:','<img src="' . $setting['siteurl'].'templates/'.$setting['theme'].'/skins/'.$setting['skin'].'/images/smileys/evil.gif" title="evil" alt="evil" />',$text); $text = str_replace(':lol:','<img src="' . $setting['siteurl'].'templates/'.$setting['theme'].'/skins/'.$setting['skin'].'/images/smileys/lol.gif" title="lol" alt="lol" />',$text); $text = str_replace(':x','<img src="' . $setting['siteurl'].'templates/'.$setting['theme'].'/skins/'.$setting['skin'].'/images/smileys/mad.gif" title="mad" alt="mad" />',$text); $text = str_replace(':P','<img src="' . $setting['siteurl'].'templates/'.$setting['theme'].'/skins/'.$setting['skin'].'/images/smileys/razz.gif" title="razz" alt="razz" />',$text); $text = str_replace(':oops:','<img src="' . $setting['siteurl'].'templates/'.$setting['theme'].'/skins/'.$setting['skin'].'/images/smileys/redface.gif" title="redface" alt="redface" />',$text); $text = str_replace(':roll:','<img src="' . $setting['siteurl'].'templates/'.$setting['theme'].'/skins/'.$setting['skin'].'/images/smileys/rolleyes.gif" title="rolleyes" alt="rolleyes" />',$text); $text = str_replace(':(','<img src="' . $setting['siteurl'].'templates/'.$setting['theme'].'/skins/'.$setting['skin'].'/images/smileys/sad.gif" title="sad" alt="sad" />',$text); $text = str_replace(':)','<img src="' . $setting['siteurl'].'templates/'.$setting['theme'].'/skins/'.$setting['skin'].'/images/smileys/smile.gif" title="smile" alt="smile" />',$text); $text = str_replace(':o','<img src="' . $setting['siteurl'].'templates/'.$setting['theme'].'/skins/'.$setting['skin'].'/images/smileys/surprised.gif" title="surprised" alt="surprised" />',$text); $text = str_replace(':twisted:','<img src="' . $setting['siteurl'].'templates/'.$setting['theme'].'/skins/'.$setting['skin'].'/images/smileys/twisted.gif" title="twisted" alt="twisted" />',$text); $text = str_replace(':wink:','<img src="' . $setting['siteurl'].'templates/'.$setting['theme'].'/skins/'.$setting['skin'].'/images/smileys/wink.gif" title="wink" alt="wink" />',$text); if ($setting['seo']=='yes') { $memberlink = $setting['siteurl'].'showmember/'.$id.'.html'; } else { $memberlink = $setting['siteurl'] . 'index.php?act=showmember&id='.$id; } if ( $row2['useavatar'] == '1' ) { $avatarimage = $setting['siteurl'] . 'avatars/' . $row2['avatarfile']; } else { $avatarimage = $setting['siteurl'] . 'avatars/useruploads/noavatar.jpg'; } ?> <div class="profile"> <ul> <li class="title">Username - <a href="<?php echo $memberlink;?>"><?php echo $row['name'];?></a></li> <li class="profilepic"><a href="<?php echo $memberlink;?>"><img src="<?php echo $avatarimage;?>" width="130" height="100"></a> </li> </ul> <ul> <li class="title2"><?php echo $row['timestamp'];?></li> <li class="aboutme"><?php echo $text;?></li> </ul> </div> <div class="clear"></div> <?php } ?> </div> <div class="clear"></div> </div> <div class="clear"></div> </div> <div class="container_box1"><div id="headergames2">Leave a comment:</div> <div class="containbox"> <center><div id="preview"></div></center> <div id="commentBox"> <center> <form name="addcomment" id="addcomment" method="post" action=""><strong>Message:</strong><br /> <div id="smiles"><center> <a href="javascript:addsmilie(' :D ')"><img src="<?php echo $setting['siteurl'].'templates/'.$setting['theme'].'/skins/'.$setting['skin'].'/images/smileys/biggrin.gif';?>" border="0" /></a> <a href="javascript:addsmilie(' :? ')"><img src="<?php echo $setting['siteurl'].'templates/'.$setting['theme'].'/skins/'.$setting['skin'].'/images/smileys/confused.gif';?>" border="0" /></a> <a href="javascript:addsmilie(' 8) ')"><img src="<?php echo $setting['siteurl'].'templates/'.$setting['theme'].'/skins/'.$setting['skin'].'/images/smileys/cool.gif';?>" border="0" /></a> <a href="javascript:addsmilie(' :cry: ')"><img src="<?php echo $setting['siteurl'].'templates/'.$setting['theme'].'/skins/'.$setting['skin'].'/images/smileys/cry.gif';?>" border="0" /></a> <a href="javascript:addsmilie(' :shock: ')"><img src="<?php echo $setting['siteurl'].'templates/'.$setting['theme'].'/skins/'.$setting['skin'].'/images/smileys/eek.gif';?>" border="0" /></a> <a href="javascript:addsmilie(' :evil: ')"><img src="<?php echo $setting['siteurl'].'templates/'.$setting['theme'].'/skins/'.$setting['skin'].'/images/smileys/evil.gif';?>" border="0" /></a> <a href="javascript:addsmilie(' :lol: ')"><img src="<?php echo $setting['siteurl'].'templates/'.$setting['theme'].'/skins/'.$setting['skin'].'/images/smileys/lol.gif';?>" border="0" /></a> <a href="javascript:addsmilie(' :x ')"><img src="<?php echo $setting['siteurl'].'templates/'.$setting['theme'].'/skins/'.$setting['skin'].'/images/smileys/mad.gif';?>" border="0" /></a> <a href="javascript:addsmilie(' :P ')"><img src="<?php echo $setting['siteurl'].'templates/'.$setting['theme'].'/skins/'.$setting['skin'].'/images/smileys/razz.gif';?>" border="0" /></a> <a href="javascript:addsmilie(' :oops: ')"><img src="<?php echo $setting['siteurl'].'templates/'.$setting['theme'].'/skins/'.$setting['skin'].'/images/smileys/redface.gif';?>" border="0" /></a> <a href="javascript:addsmilie(' :roll: ')"><img src="<?php echo $setting['siteurl'].'templates/'.$setting['theme'].'/skins/'.$setting['skin'].'/images/smileys/rolleyes.gif';?>" border="0" /></a> <a href="javascript:addsmilie(' :( ')"><img src="<?php echo $setting['siteurl'].'templates/'.$setting['theme'].'/skins/'.$setting['skin'].'/images/smileys/sad.gif';?>" border="0" /></a> <a href="javascript:addsmilie(' :) ')"><img src="<?php echo $setting['siteurl'].'templates/'.$setting['theme'].'/skins/'.$setting['skin'].'/images/smileys/smile.gif';?>" border="0" /></a> <a href="javascript:addsmilie(' :o ')"><img src="<?php echo $setting['siteurl'].'templates/'.$setting['theme'].'/skins/'.$setting['skin'].'/images/smileys/surprised.gif';?>" border="0" /></a> <a href="javascript:addsmilie(' :twisted: ')"><img src="<?php echo $setting['siteurl'].'templates/'.$setting['theme'].'/skins/'.$setting['skin'].'/images/smileys/twisted.gif';?>" border="0" /></a> <a href="javascript:addsmilie(' :wink: ')"><img src="<?php echo $setting['siteurl'].'templates/'.$setting['theme'].'/skins/'.$setting['skin'].'/images/smileys/wink.gif';?>" border="0" /></a> </center></div> <textarea name="comment" rows="10" cols="60" id="comment_message"></textarea> <br /> <input type="hidden" name="timestamp" id="timestamp" value="<?php echo time(); ?>" /><br/> </center> <center> <input name="name" type="hidden" value="<?php echo $_SESSION['user'];?>" /><br /> <input type="hidden" name="recaptcha" id="recaptcha" value="no"> <input type="hidden" name="security" id="security" value="10"> <input type="hidden" name="member" value="yes"> <input type="hidden" name="userid" id="userid" value="<?php echo $id; ?>"> <input name="addcomment" type="submit" value="Add Comment" style="border: 1px solid #000; margin-top: 2px;" /><br/><br/> </form></center></div></div> <div class="clear"></div> <?php } ?> </div> Ps: sry for the long code. Hey there,
First time using MySQL database to connect to a member login. I have a paid subscription site through ccbill which they add the username and logins to. I have setup a database, username and password as well as a table that I have connected correctly "I believe" to my website but get this message: warning: MySQL-fetch_array()expects parameter 1 to be resource, Boolean given in /home....
My table I have setup just has username and password to authenticate the users, which I was told by ccbill is all I need. Maybe I need authentication 1 or 0 etc.
Any help on this would be amazing. Spent hours trying to figure this out but nothing.
Thanks for your time.
Steven
Hello, I need some help. Say that I have a list in my MySQL database that contains elements "A", "S", "C", "D" etc... Now, I want to generate an html table where these elements should be distributed in a random and unique way while leaving some entries of the table empty, see the picture below. But, I have no clue how to do this... Any hints? Thanks in advance, Vero How would I compare 2 random numbers to rows in a table. The table has 4 rows and 2 colums. My table is setup like this: ID hp mp then has just randomly placed numbers from 0 to 5. So far my script looks like this: I have $new_hp=rand(0,5); $new_mp=rand(0,5). Then i query the db by $myquery=doquery("select hp,mp from users"; $myrow=mysql_fetch_array($myquery); once this is done would a while statement like while ($myrow = mysql_fetch_array($myquery) to what each line in the table has? I would then need to compare the random numbers to those entries in the database. Something like if($myrow[hp] == $new_hp && $myrow[mp] == $new_mp) { ? But if the if statement isnt true it needs go back choose another random number and run same again and again until the statement is true and that is where im stuck at so any help would be greatly appreciated I have a user table that holds email addresses and for testing purposes I am trying to replace every email address with an email address defined in an array. I would like to randomly choose an email address from the array and update the table with this address. When I run the following code it randomly chooses a email address from the array but then updates every row with this one email address. Can you someone please let me know what I am doing wrong. Thanks in advance. Code: [Select] $query = "SELECT * FROM user '"; $result = mysql_query($query); $input = array('email1', 'email2', 'email3', 'email4', 'email5', 'email6', 'email7'); $rand_keys = array_rand($input, 2); $replaceStr = $input[$rand_keys[0]]; while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $rand_keys = ""; $rand_keys = array_rand($input, 2); $replaceStr = $input[$rand_keys[0]]; mysql_query("UPDATE user SET email = '$replaceStr'"); } Hi, I'm a researcher (and complete coding noob), and am planning a longitudinal study that requires e-mail follow-up with subjects taking an initial survey. For purposes of ethics/anonymity due to sensitive survey data, I'd like the acquired e-mails to be saved uncoupled from the survey responses; this is simple to deal with, and I use a basic PHP e-mail form, which injects the email address in a table in MySQL in a different server than the one used for the survey. The issue is that the e-mails are saved in the MySQL database in order of injection, thus it is still theoretically possible for me to link the e-mails back to the survey responses (which have a time stamp that I cannot remove). Ideally I would like not to be able (at all) to link the e-mails to the survey responses, and one way to do that (since I don't save the e-mail injection timestamps in MySQL) might be to have the e-mails saved in MySQL in a random order. Not sure if this is possible, and not even sure if this would be via PHP or MySQL side of things. The server is on godaddy and uses Starfield interface for MySQL but I cannot find an option for random insert/saving of table items (emails). They are saved in order of injection. Any solution for this? Thanks, As above, I have a lottery style site that picks a random number between 1-8 but my users complain for some reason that this is not enough. So i was told to look into using fopen and random.org to generate a random number. Anyone have experience of this and perhaps a code snippet for me to look at and possibly use? help will be appreciated. Hi,
I'm new here. I used to have a coworker to do the PHP stuff, but now I've gotta try to learn it. Thanks!
New member to this forum. However, I've been working with PHP/MySQL for a couple years.
Looking to learn some new things as well as contribute when possible.
Hey, i was wondering if anyone knew how i could make a script so when i register a new account... There will be made a link in members.php and when you go there you see the new registered (and the old ones) name... And once you click it you get into their page (their page should be created when registering a new account). Im pretty blank how to do it so ill ask you guys :/ This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=322218.0 hey i was trying to make a new login system with member area the problem is that i wanted to add point system which i can add points manual to members by creating a new column called 'points' and add the following code to member area echo 'you got , '.$_SESSION['points']; but it didn`t work here is my member.php page any tip or advice would be helpful much appreciated ♥ <?php session_start(); Hi guys i've spent 3 whole days trying to get this to work but it dosent. My issue is very similar almost the same as: http://www.phpfreaks.com/forums/index.php?topic=296100.15 but with the code i have. Basically i have custom member pages. member1.php member2.php the design and content will be custom to each member, they also have their own login page. Each member should be able to access their page and simply view their secure area. They should not be able to log into another users area if they dont have the username or password for it. Now the problem is, i have this entire script setup and it works, however i fear there is something wrong with the sessions which allows other members to access other members pages with their own passwords and usernames because they share the same database. So the script executes thinking its a valid user and lets them in. Here is my login checker once the user is validated they are sent to their own folder header("Location: ../{$loginusername}/index.php"); and are able to view the page. Code: [Select] <?php require_once('../config.php'); // Connect to the server and select the database. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db")or die("Unable to select database"); // The username and password sent from login.php $loginusername=$_POST['username']; $loginpassword=$_POST['password']; //The following bit of coding protects from MySQL injection attacks $loginusername = stripslashes($loginusername); $loginpassword = stripslashes($loginpassword); $loginusername = mysql_real_escape_string($loginusername); $loginpassword = mysql_real_escape_string($loginpassword); $sql="SELECT * FROM $tbl WHERE username='$loginusername' and password='$loginpassword'"; $result=mysql_query($sql); // Count how many results were pulled from the table $count=mysql_num_rows($result); // If the result equals 1, continue if($count==1){ session_start(); $_SESSION["loginusername"] = $loginusername; $_SESSION['user1'] = $username; // store session data //echo "User: = ". $_SESSION['loginusername']; //retrieve data header("Location: ../{$loginusername}/index.php"); } // If not successful, inform the user of error else { echo "Wrong Username or Password"; } ?> Now here is the secure page sample: Code: [Select] <?php session_start(); if (!$_SESSION['user1']){ header("Location: login.php"); }else{ print "its working!"; } ?> <html> <body> Login Successful for </body> </html> For each login page i have given each user it's own session.. this works, however if user1 logs in and simply changes the url to user2 and enters his user2 password he is granted access giving him new sessions which means he has access to everything. Im pretty sure im missing something really small any help would be appreciated. hi i have set up my1 st member area (www.sittonjewelryshop.com). everything works fine except of 1 thing with the checkuser and the verify php files. i have set it up that if some one is trying to go directly to the member area without register it wont let him and send him to the login area but for some reasson it doesnt work. if you write www.sittonjewelryshop.com/member/login_success.php it takes you directly to the membera area. was trying to manipulate verify.php and register.php but could find the problem. any suggestion? tnx. Ok, so I don't really understand a lot about OOP. I was given a two big files full of classes and functions. We were hand coding this file for each use. My objective was to make an array we could use to ease the pain of coding these features. Here is an example of what is happening to me. Can someone advise me conceptually on what to do. Code: [Select] include('Tons of files included here'); $myarray = array( 0 => array("question" => "answer"), 1 => array("question1" => "answer1") ); class BigClass { var $a var $b function fiststep(){ global $myarray; foreach($myarray as $anarray) { $this->$anarray = new includedfunction1($anarray["question"]); $this->$anarray->Values = array(array("yes", "yes"), array("no", "no")); $this->$anarray->Multiple = true; } } function nthstep(){ global $myarray; foreach($myarray as $anarray) { $this->$anarray->astep(); // Error occurs: Call to a member function on a non-object } } } include('Tons of files included here'); There seem to be a number of steps that occur in one of the 10-20 include files before the data comes back to the nthstep. Once it comes back. I cannot seem to get it to be recognized as an object. If I were to manually type out the contents of $anarray. I get NO error. I am very over my head. Does anyone have a conceptual idea of my issue? Hey everybody, please help a newba out........ I am trying to allow users to create a favorites list. Basically there will be a list of links users can access, and I want them to be able to add individual links to their own favorites list. I'm pretty new to php and mysql, but here's what i'm thinking... User registers. User gets added to table "users", and a new table is created "new_user_1 favorites" User clicks "add to my favorites", next to a link they like. Link is added to "new_user_1 favorites". Table "new_user_1 favorites" is displayed under link "My Favorites". How does this sound? Is this the way to do it, or is there something i'm missing? Do I really need a individual table for each users favorites, or is there an more efficient way? Any input would be appreciated. Thanks folks. I am having problem with calling class member from with the function in that class. <?php class board { function __construct () { $num_sheep_init=20; $num_lion_init=2; $board_value=array(0=>'', 1=>'', 2=>'', 3=>'', 4=>'', 5=>'', 6=>'', 7=>'', 8=>'', 9=>'', 10=>'', 11=>'', 12=>'', 13=>'', 14=>'', 15=>'', 16=>'', 17=>'', 18=>'', 19=>'', 20=>'', 21=>'', 22=>'', 23=>'', 24=>''); $random_array_value=array (0,1,2,3,4,5,7,9,10,11,13,14,15,17,19,20,21,22,23,24); $selected_index=array(); $randd=array(); $countt=0; } function init_board () { $this->board_value['6']="S"; Above is part of the code where i am having problem. It says that it can not access empty property //$this->board_value['6']="S"; I have a problem with database search for a member. I am pretty sure my sql is correct. It must be my if statements. Upon submitting the search for a member, even if there is not a match, the link appears for the member that was entered into the search. I only want the link to show up if there is a match. Thank you in advance. Code: [Select] <?php error_reporting(E_ALL); require_once("./include/membersite_config.php"); //session_start();//FOR GETTING USER ONLINE SCRIPT header("Cache-Control: nocache"); header("Expires: 0"); if(!$fgmembersite->CheckLogin()) { $fgmembersite->RedirectToURL("login.php"); exit; } $currentUser=$_SESSION['name_of_user']; // set current user name logged in to $currentUser to grab his profil DB data later. if(!$fgmembersite->CheckLogin()) { $fgmembersite->RedirectToURL("login.php"); exit; } //define a maxim size for the uploaded images in Kb define ("MAX_SIZE","100"); //This function reads the extension of the file. It is used to determine if the file is an image by checking the extension. function getExtension($str) { $i = strrpos($str,"."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str,$i+1,$l); return $ext; } //This variable is used as a flag. The value is initialized with 0 (meaning no error found) //and it will be changed to 1 if an errro occures. //If the error occures the file will not be uploaded. $errors=0; include 'memberHeader.php'; if (isset($_POST['submit'])) { $memberSearch=$_POST['memberSearch']; mysql_connect(" ", " ", " ") or die(mysql_error()); // info left out mysql_select_db(" ") or die(mysql_error()) ; $sql = "SELECT username FROM users WHERE username='$memberSearch'"; $result = mysql_query($sql); echo $result; if (!$result) { echo "no matching member found " . mysql_error(); exit; } if($result) { echo "Your search result link: <a href='viewProfile.php?userPage=".$memberSearch."'>click here for result</a>"; } ////////////////////////////////MEMBER SEARCH FORM////////////// } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <p> </p><p> </p><p><? echo "<p> </p><p></p><form id='form1' name='form' method='post' action=''> Enter a member's name here to search <input type='text' name='memberSearch' id='memberSearch' /> <input type='submit' name='submit' id='submit'/> </form>"; ?> </p> </body> </html> |