Jump to content

realfam

Members
  • Posts

    12
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

realfam's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I have a code script but for some reason all I get is a blank page when I break it into 2 files, as is in 1 file it just returns to the exact page in the web browser, its not displaying any results....or anything for that matter. <h2>Search</h2> <form name="search" method="post" action="<?=$PHP_SELF?>"> Seach for: <input type="text" name="find" /> in <Select NAME="field"> <Option VALUE="first">First Name</option> <Option VALUE="last">Last Name</option> <Option VALUE="city">City</option> <Option VALUE="state">State</option> </Select> <input type="hidden" name="searching" value="yes" /> <input type="submit" name="search" value="Search" /> </form> <? //This is only displayed if they have submitted the form if ($searching =="yes") { echo "<h2>Results</h2><p>"; //If they did not enter a search term we give them an error if ($find == "") { echo "<p>You forgot to enter a search term"; exit; } // Otherwise we connect to our Database include("dbinfo.inc.php"); mysql_connect(localhost,$username,$password); @mysql_select_db($database) or die( "Unable to select database"); // We preform a bit of filtering $find = strtoupper($find); $find = strip_tags($find); $find = trim ($find); //Now we search for our search term, in the field the user specified $data = mysql_query("SELECT * FROM contacts WHERE upper($field) LIKE'%$find%'"); //And we display the results while($result = mysql_fetch_array( $data )) { echo $result['first']; echo " "; echo $result['last']; echo "<br>"; echo $result['city']; echo "<br>"; echo $result['state']; echo "<br>"; echo "<br>"; } //This counts the number or results - and if there wasn't any it gives them a little message explaining that $anymatches=mysql_num_rows($data); if ($anymatches == 0) { echo "Sorry, but we can not find an entry to match your query<br><br>"; } //And we remind them what they searched for echo "<b>Searched For:</b> " .$find; } ?> So I need to get the search script working, and I need to tweak/tie all this together....thats where I am lacking knowledge. Any advice would be greatly appreciated. Thanks!
  2. ok, I have completed most of what I need to make this all work, a little fuzzy on the rest. Here is what I have (code displayed also): 1) Form To Input Data Into Database (bare bones, not styled) <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"> <title></title> </head> <body> <form action="insert.php" method="post"> First Name: <input name="first" type="text"><br> Last Name: <input name="last" type="text"><br> City: <input name="city" type="text"><br> State: <input name="state" type="text"><br> <br> <input type="submit"> </form> </body> </html> 2) PHP Script to Add Information From Form To Database <?php include("dbinfo.inc.php"); $first=$_POST['first']; $last=$_POST['last']; $city=$_POST['city']; $state=$_POST['state']; mysql_connect(localhost,$username,$password); @mysql_select_db($database) or die( "Unable to select database"); $query = "INSERT INTO contacts VALUES ('','$first','$last','$city','$state')"; mysql_query($query); if($query) { echo "Ex Brief Submitted Successfully."; } else { echo "The Ex Brief was not processed. Please review the information you entered for accuracy."; } mysql_close(); ?> 3) PHP Script to Display Results from Database on webpage <? include("dbinfo.inc.php"); mysql_connect(localhost,$username,$password); @mysql_select_db($database) or die( "Unable to select database"); $query="SELECT * FROM contacts"; $result=mysql_query($query); $num=mysql_numrows($result); mysql_close(); echo "<b><center>Database Output</center></b><br><br>"; ?> <table border="0" cellspacing="2" cellpadding="2"> <tr> <th><font face="Arial, Helvetica, sans-serif">Name</font></th> <th><font face="Arial, Helvetica, sans-serif">City</font></th> <th><font face="Arial, Helvetica, sans-serif">State</font></th> </tr> <? $i=0; while ($i < $num) { $first=mysql_result($result,$i,"first"); $last=mysql_result($result,$i,"last"); $city=mysql_result($result,$i,"city"); $state=mysql_result($result,$i,"state"); ?> <tr> <td><font face="Arial, Helvetica, sans-serif"><? echo "$first $last"; ?></font></td> <td><font face="Arial, Helvetica, sans-serif"><? echo "$city"; ?></font></td> <td><font face="Arial, Helvetica, sans-serif"><? echo "$state"; ?></font></td> <? ++$i; } echo "</table>"; ?> Now I am very vague on how to write a search script to allow users to search the database and have the results of the search on the webpage. I guess some guidance and suggestions on how to make all this work the best would be great thanks!
  3. I can do that. I will create what I know and come back, should be a few hours I need to step out for a bit then maybe with your help I can get the code modified correctly and be able to implement it. Thanks.
  4. I agree. As I stated a few times, I am not a PHP expert. I know how to do all the basic scripts, but getting them to work exactly how I want them seems to be where I fall short. I will create what I can then come back to see if you can help me tweak the scripts. Also not trying to sound rude, but if I knew what I was doing I would not be here bothering everyone. It would be hard to have a PHP Help board if everyone on it already knew all the answers...there would be no questions, LOL! Thanks.
  5. I thought as much. Database is setup, has a table with the required fields, except I do not know how to save images that go with this information in the database. I want to create a page with a search form, I think I can handle writing an HTML form to call the php search file. Not 100% sure on how to do the php file that will perform the search. I need it to be able to search with the form info supplied by the user, which will be as little as 1 piece of info or more, to return the results in order of relevance. And not sure on how to call up the results and display them. The really tricky part I probably will not be able to figure out is the flagging system, and how to make these appear in users profiles if users select these people as "exes". I guess I am just totally lost. Seemed easy at first but has gotten very complicated. Help on any parts will be appreciated. thanks!
  6. Here is what I would like the output to be like, may help with the question
  7. I have a MySQL database created. I also have a website powered by WordpressMU up and running. I am somewhat familiar with php, but no expert. The site is www.ex-brief.com Here is what I am trying to accomplist, I know it will take a combination of an HTML form, and some php scripts to make this work, but for some reason I can not get it to all come together. What I want is this: I want people to be able to enter information on their ex, including name, city, state, wether they had a positive or negative experience and a comment and photo. Obviously all this info will be saved in the database, which needs to be searchable by any combination of the variables (name, city, etc.). I would like each profile to have a unique ID number and for users to be able to flag them for inappropriate content which will send a notice to the admin who can edit or delete the profile. I would like people to be able to add comments as well (comments should get a date stamp) that have also dated this person. Also if you have selected them a your ex I want there to be a link to their ex-profile page in the your user profile. Anyone help me out here? thanks.
  8. wow, no replies. this sucks. Guess I am on my own. thanks
  9. Here it is: <div id="sidebar"> <ul> <?php if ( !is_user_logged_in() ) : ?> <br /><br /><br /><div style="text-align: center;"> <form name="login-form" id="login-form" action="<?php get_option('home') ?>/wp-login.php" method="post"><input size="15" name="log" id="user_login" value="Username" onfocus="if (this.value == 'Username') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Username';}"><input size="15" name="pwd" id="user_pass" class="input" value="" type="password"> <!--<input name="rememberme" type="checkbox" id="rememberme" value="forever" />--> <p><input name="wp-submit" id="wp-submit" value="<?php _e( 'Log In', 'buddypress' ) ?>" type="submit"><input name="redirect_to" value="http://<?php echo $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'] ?>" type="hidden"><input name="testcookie" value="1" type="hidden"> </p> </form> </div> </ul> <p style="text-align: center;"><a href="/wp-signup.php?action=lostpassword">Sign Up</a> &#124; <a href="/wp-login.php?action=lostpassword">Lost Password?</a><br> <?php else : ?> <div id="logout-link"> <?php bp_loggedinuser_avatar_thumbnail( 20, 20 ) ?> <?php bp_loggedinuser_link() ?> <?php if ( function_exists('wp_logout_url') ) : ?> / <a href="<?php echo wp_logout_url(site_url()) ?>" alt="<?php _e( 'Log Out', 'buddypress' ) ?>"><?php _e( 'Log Out', 'buddypress' ) ?></a> <?php else : ?> <br><A href="/wp-admin/">Dashboard</a> <br><a href="/wp-admin/post-new.php">Profile</a> <br> <a href="<?php echo site_url() . '/wp-login.php?action=logout&redirect_to=' . site_url() ?>"><?php _e( 'Log Out', 'buddypress' ) ?></a> <?php endif; ?> <br /><br /><br /></div> <?php endif; ?> <br /><br /> <?php /* Widgetized sidebar, if you have the plugin installed. */ if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar() ) : ?> <li> <?php include (TEMPLATEPATH . '/searchform.php'); ?> </li> <!-- Author information is disabled per default. Uncomment and fill in your details if you want to use it. <li><h2>Author</h2> <p>A little something about you, the author. Nothing lengthy, just an overview.</p> </li> --> <?php if ( is_404() || is_category() || is_day() || is_month() || is_year() || is_search() || is_paged() ) { ?> <li> <?php /* If this is a 404 page */ if (is_404()) { ?> <?php /* If this is a category archive */ } elseif (is_category()) { ?> <p>You are currently browsing the archives for the <?php single_cat_title(''); ?> category.</p> <?php /* If this is a yearly archive */ } elseif (is_day()) { ?> <p>You are currently browsing the <a href="<?php bloginfo('url'); ?>/"><?php echo bloginfo('name'); ?></a> blog archives for the day <?php the_time('l, F jS, Y'); ?>.</p> <?php /* If this is a monthly archive */ } elseif (is_month()) { ?> <p>You are currently browsing the <a href="<?php bloginfo('url'); ?>/"><?php echo bloginfo('name'); ?></a> blog archives for <?php the_time('F, Y'); ?>.</p> <?php /* If this is a yearly archive */ } elseif (is_year()) { ?> <p>You are currently browsing the <a href="<?php bloginfo('url'); ?>/"><?php echo bloginfo('name'); ?></a> blog archives for the year <?php the_time('Y'); ?>.</p> <?php /* If this is a monthly archive */ } elseif (is_search()) { ?> <p>You have searched the <a href="<?php echo bloginfo('url'); ?>/"><?php echo bloginfo('name'); ?></a> blog archives for <strong>'<?php the_search_query(); ?>'</strong>. If you are unable to find anything in these search results, you can try one of these links.</p> <?php /* If this is a monthly archive */ } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { ?> <p>You are currently browsing the <a href="<?php echo bloginfo('url'); ?>/"><?php echo bloginfo('name'); ?></a> blog archives.</p> <?php } ?> </li> <?php }?> <?php wp_list_pages('title_li=<h2>Pages</h2>' ); ?> <li><h2>Archives</h2> <ul> <?php wp_get_archives('type=monthly'); ?> </ul> </li> <?php wp_list_categories('show_count=1&title_li=<h2>Categories</h2>'); ?> <?php /* If this is the frontpage */ if ( is_home() || is_page() ) { ?> <?php wp_list_bookmarks(); ?> <li><h2>Meta</h2> <ul> <?php wp_register(); ?> <li><?php wp_loginout(); ?></li> <li><a href="http://validator.w3.org/check/referer" title="This page validates as XHTML 1.0 Transitional">Valid <abbr title="eXtensible HyperText Markup Language">XHTML</abbr></a></li> <li><a href="http://gmpg.org/xfn/"><abbr title="XHTML Friends Network">XFN</abbr></a></li> <li><a href="http://wordpress.org/" title="Powered by WordPress, state-of-the-art semantic personal publishing platform.">WordPress</a></li> <?php $current_site = get_current_site(); ?> <li><a href="http://<?php echo $current_site->domain . $current_site->path ?>wp-signup.php" title="Create a new blog">New Blog</a></li> <li><a href="http://<?php echo $current_site->domain . $current_site->path ?>" title="<?php echo $current_site->site_name ?>"><?php echo $current_site->site_name ?></a></li> <?php wp_meta(); ?> </ul> </li> <?php } ?> <?php endif; ?> </ul> </div> (edited to add tags)
  10. I have a script on my main page that lets you log in and sign up. I have the form styled the way I want it to look and it functions properly. Once you log in the formatting of that area is not the same and I can not get it to be centered and clean like it is before you log in. Can anyone help me out? I can put code on here if needed. www.ex-brief.com HERE IS A FAKE USER ALREADY SET UP: Username: help Password: help
×
×
  • 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.