Jump to content

clint

Members
  • Posts

    18
  • Joined

  • Last visited

Everything posted by clint

  1. Hi, thanks for the reply. Sorry if my explanation wasnt very clear. I am trying to keep it as simple as possible so there are 2 tables excluding the user table. There is only one user in the users table. Table 1: news This table has the following columns: id, topic, content, date Table 2: emails This table has 2 columns: id and address (id is unique, auto incrememnt and the address is just the email address such as that@this.com) There will only be a few addresses in the emails table and these will get added on another page. There is a insert form to insert into the news table which worked fine and it sent a mail to mail server but with no "to address" I hope this clears things up. Thanks again for your time. Super appreciated!!
  2. Good day all, I am trying to create a form where you fill it in and submit. When its submitted to db it selects email addresses from db and mails all addresses in that table to let them know there was a new post. Below is what I have. It inserts into db and sends mail to test server but not to addresses in table so both functions are working separately but I am struggling to tie them together. How do I go about combining the 2 to make it work? Thank you in advance! public function mailing_list() { $query = $this->db->prepare("SELECT address FROM `emails`"); try{ $query->execute(); return $query->fetchALL(); foreach ($query as $row) { $address = $row['address']; } } catch(PDOException $e){ die($e->getMessage()); } } public function insert_newscast($topic, $content) { $query = $this->db->prepare("INSERT INTO `news` (`topic`, `content`, `date`) VALUES (?, ?,NOW()) "); $query->bindValue(1, $topic); $query->bindValue(2, $content); try{ $query->execute(); $to = implode(", ", $address); $subject = $topic; $message = ' <html> <head> <title>Notification from test site</title> </head> <body> <p>New post up on the Website!</p> <a href = "http://www.test.co.za">Take a look</a> <p>Regards,<br />The Team!</p> </body> </html> '; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; mail($to, $subject, $message, $headers); }catch(PDOException $e){ die($e->getMessage()); } }
  3. You mean like: <?php if ($today =="Sunday") { echo 'today is sunday'; } ?> along those lines? Or as cyberRobot said ^^
  4. Oh I see. Cool, thought I was getting clever Will make some changes as you suggested. I suppose narrowing input options leaves less chance for something to go wrong at the end of the day in any case! thanks for the advice. Much appreciated!
  5. Absolutely... Basically the keywords are for the following function: There are 2 types of users, recruitment agency and job seeker (using this as a test to see how it works). A job seeker will add skill keywords to the "seek_employment" table as in the above query that will define skills they have and will be something like, PHP, MySQL, Internet, Web Development...... A recruiter can then instead of constant searching, add what skills they are looking for to the "job_box" table as above. So if they are looking for a web developer and they add PHP, ASP, Web Development..... The above query was for a page on the recruiters side where they can see the results of all the queries they have added to the job_box table and displays the name and contact number of the job seeker so you can view their profiles. It just eliminates searching and of course not all the kwywords will match in both tables. If that makes sense.....? Additional info: Table(seek_details) contains the name, surname, etc of the job seeker. Table (seek_employment) contains the resume details including the job seekers keywords. table (job_box) contains the keywords of the recruiter. Long story short, the keywords would be something like: PHP, MySQL, ASP, Accountancy....... Thanks again for the help.
  6. Good day all, I hope you could help me in the right direction with my dillema. I have 3 tables and I am trying to show data based the user_id's of 2 tables being the same and keywords in 2 the same or at least similar. I have it working if the keywords match exactly but I dont know how to use the LIKE % in this sort of situation. Here is what I have and it works it the 2 colums are an exact match but I dont want exact match: public function get_job_box($id) { $query = $this->db->prepare("SELECT * FROM seek_details AS s JOIN seek_employment AS e ON ( s.sd_user_id = e.se_user_id ) JOIN job_box AS j ON ( j.skill_keywords LIKE e.skill_keywords ) WHERE j.jb_user_id = ?"); $query->bindValue(1, $id); try{ $query->execute(); return $query->fetchALL(); } catch(PDOException $e){ die($e->getMessage()); } } Any help or thoughts would be highly appreciated! Thank you
  7. Hello, Please excuse me if this sounds like a bit of a newb question. If I have a link to a users profile and use GET to pull information about that user from various tables using something like this: <?php { $id = $_GET['id']; $user = mysql_query("SELECT * FROM users,tbl1,tbl2,tbl3,tbl4,tbl5 WHERE $id=tbl1.user_id AND tbl1.user_id=tbl2.user_id AND tbl2.user_id=tbl3.user_id ANDtbl3.user_id=tbl4.user_id AND tbl4.user_id=tbl5.user_id"); $user=mysql_fetch_assoc($user); } ?> <h3>Table 1</H3> <?php echo "<b>".$user['tbl1_title']."<br>"; ?><br /> <h3>Table 2</H3> <?php echo "<b>".$user['tbl2_title']."<br>"; ?><br /> <h3>Table 3</H3> <?php echo "<b>".$user['tbl3_title']."<br>"; ?><br /> <h3>Table 4</H3> <?php echo "<b>".$user['tbl4_title']."<br>"; ?><br /> <h3>Table 5</H3> <?php echo "<b>".$user['tbl5_title']."<br>"; ?><br /> Why does it only show the 1st record for that user from each table? And mostly, how do I change it to show all or a certain number of records from each table? Any help would be greatly appreciated. Thanks in advance
  8. Good morning I am trying to add an "add to contacts" button to the user profile page that is viewed by other users but I seem to be struggling to wrap my head around this one. I can create the search user page that populates a list of users based on search criteria and link to their respective profiles using GET. But now if I have a "add to contacts" button on their profile page, I am struggling with the code to insert this into a contacts table correctly. If the contacts table has a id column, user_id column and contacts_id column how do I insert the id of the user you are viewing into the contacts_id column? I should have something along these lines....: if (isset($_SESSION['user_id'])) $user_id = ($_POST['user_id']); $sql_insert = "INSERT into `contacts` (`user_id`,`id`,`date`) VALUES ('".$_SESSION['user_id']."','$id',now())"; mysql_query($sql_insert,$link) or die("Insertion Failed:" . mysql_error()); $user_id = mysql_insert_id($link); but that is not going to add the id as contact id for the profile being viewed. Should this be done totally differently? Any help in this regard would be highly appreciated. Apologies if I have not explained properly. Thank you
  9. Hello, I am having a bit of difficulty with the following and would like a bit of guidance if possible: I have a users table and a jobs table. When the user inserts a job into the jobs table it saves the user id in the jobs table in a user_id column. Now, I have the code working where I can view all the jobs in the table and using GET go to a job profile page which displays the full job details and user name using a join. The part I am struggling with is to make the user name that is displayed on the job profile view page a link to the users profile. So if you view the job you can click on the company name to view their profile. Here is what I have: View list of jobs: <?php include 'dbc.php'; page_protect(); if($_GET['page']) // Is page defined? { $page = $_GET['page']; // Set to the page defined }else{ $page = 1; // Set to default page 1 } $max = 10; // Set maximum to 10 $cur = (($page * $max) - $max); // Work out what results to show //get the mysql and store them in $result //change whatevertable to the mysql table you're using //change whatevercolumn to the column in the table you want to search $result = mysql_query("SELECT jobs.job_title,jobs.remuneration,jobs.id,users.full_name FROM `jobs`,users WHERE jobs.user_id=users.id ORDER BY job_title DESC LIMIT $cur, $max") or die(mysql_error()); // select the results //grab all the content while($r=mysql_fetch_array($result)) { //the format is $variable = $r["nameofmysqlcolumn"]; //modify these to match your mysql table columns $id=$r["id"]; $job_title=$r["job_title"]; $remuneration=$r["remuneration"]; $full_name=$r["full_name"]; echo '<a href="view_job.php? id=' . $r['id'] . '">'.$r['job_title'].' </a><br>'; echo " $remuneration <br> "; echo " $full_name <br> "; echo "<hr>"; } $counttotal = mysql_query("SELECT * FROM jobs ") or die(mysql_error()); // select all records $counttotal = mysql_num_rows($counttotal); // count records $total_pages = ceil($counttotal / $max); // dive the total, by the maximum results to show if($page > 1){ $prev = ($page - 1); echo '<a href="?page=' . $prev . '">« Previous</a>'; } for($i = 1; $i <= $total_pages; $i++) // for each page number { if($page == $i) // if this page were about to echo = the current page { echo'<b>' . $i .'</b> '; // echo the page number bold } else { echo '<a href="?page=' . $i . '">' . $i . '</a> '; // echo a link to the page } } if($page < $total_pages){ $next = ($page + 1); echo '<a href="?page=' . $next . '">Next »</a>'; // echo the next page link } ?> And here is the view job page: <?php include 'dbc.php'; page_protect(); { $id = $_GET['id']; $user = mysql_query("SELECT jobs.job_title,jobs.remuneration,jobs.terms,jobs.description,jobs.id,users.full_name FROM jobs INNER JOIN users ON jobs.user_id = users.id WHERE jobs.id = '$id'"); $user=mysql_fetch_assoc($user); } echo "<h1><b>".$user['full_name']."<br></h1>"; echo "<h1><b>".$user['job_title']."<br></h1>"; echo "<br>"; echo "<br>"; ?> <font color="#FF0000"><b>Job Title:</b></font> <?php echo "<b>".$user['job_title']." <br> ";?> <font color="#FF0000"><b>Remuneration:</b></font> <?php echo "<b>".$user['remuneration']." <br> ";?> <font color="#FF0000"><b>Payment Terms:</b></font> <?php echo "<b>".$user['terms']." <br> ";?> <font color="#FF0000"><b>Job Description:</b></font> <?php echo "<b>".$user['description']." <br> ";?> So basically on that second page is where the full name is to be a link to user profile. Do I have to add a 2nd query? Thank you in advance, any help or advice is highly appreciated!
  10. Wow! What a silly mistake! Thank you so much! That did the trick
  11. Hello, I was hoping I could get a little help on the following: I have a form to insert a job into the job table which is accessed by users on the users table. The form works and adds data to the job table but is not inserting the user_id from the user so I can use it in a join. Here is my form: <?php include 'dbc.php'; page_protect(); if($_POST['submit'] == 'Submit Job') { /******************* Filtering/Sanitizing Input ***************************** This code filters harmful script code and escapes data of all POST data from the user submitted form. *****************************************************************/ foreach($_POST as $key => $value) { $data[$key] = filter($value); } /********************* RECAPTCHA CHECK ******************************* This code checks and validates recaptcha ****************************************************************/ require_once('recaptchalib.php'); $resp = recaptcha_check_answer ($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]); if (!$resp->is_valid) { die ("<h3>Image Verification failed!. Go back and try again.</h3>" . "(reCAPTCHA said: " . $resp->error . ")"); } /***************************************************************************/ if (isset($_SESSION['user_id'])) $user_id = ($_POST['user_id']); $job_title = ($_POST['job_title']); $description = ($_POST['description']); $type = ($_POST['type']); $remuneration = ($_POST['remuneration']); $terms = ($_POST['terms']); $start_date = ($_POST['start_date']); $sql_insert = "INSERT into `jobs` (`id`,`job_title`,`description`,`type`,`date`,`remuneration`,`terms`,`start_date`) VALUES ('".$_SESSION['user_id']."','$job_title','$description','$type','$remuneration','$terms','$start_date',now())"; mysql_query($sql_insert,$link) or die("Insertion Failed:" . mysql_error()); $user_id = mysql_insert_id($link); ?> <html> <head> <title>Market Affinity - Post a job</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <script language="JavaScript" type="text/javascript" src="js/jquery-1.3.2.min.js"></script> <script language="JavaScript" type="text/javascript" src="js/jquery.validate.js"></script> <script> $(document).ready(function(){ $.validator.addMethod("username", function(value, element) { return this.optional(element) || /^[a-z0-9\_]+$/i.test(value); }, "Username must contain only letters, numbers, or underscore."); $("#regForm").validate(); }); </script> <link href="styles.css" rel="stylesheet" type="text/css"> </head> <body> <table width="100%" border="0" cellspacing="0" cellpadding="5" class="main"> <tr> <td colspan="3"> </td> </tr> <tr> <td width="160" valign="top"><p> </p> <p> </p> <p> </p> <p> </p> <p> </p></td> <td width="732" valign="top"><p> <h2>Thank you</h2> Your job posting is now complete and you can <a href="mysettings.php">return to your menu here</a>"; <?php exit(); } ?> <h3 class="titlehdr">Add a job to the directory</h3> <p>Please fill out the form below to add a job to the directory.<br /> The more details you fill out the more chance of your post being read.</p> <br> <!-- this file is called insertphpfile, you are posting to inserttest.phpÉ is this correct? --> <form action="inserttest.php" method="post" name="regForm" id="regForm" > <table width="95%" border="0" cellpadding="3" cellspacing="3" class="forms"> <tr> <td colspan="2">job_title<span class="required"><font color="#CC0000">*</font></span><br> <input name="job_title" type="text" id="job_title" size="40" class="required"> </td> <td width="2"></td> </tr> <tr> <td colspan="2"> </td> <td></td> </tr> <tr> <td colspan="2">Job Description (max 300 words)<span class="required"><font color="#CC0000">*</font></span><br> <!-- you have $post['description'] but your INPUT name is job_description --> <textarea name="description" cols="80" rows="8" id="description" class="required"></textarea> </td> <td></td> </tr> <tr> <td width="168">Job Type<font color="#CC0000">*</font></td> <td width="625"> <!-- you have $post['type'] but your SELECT name is job_type --> <select name="type" class="required" id="type"> <option value="" selected></option> <option value="Permanent">Permanent</option> <option value="Part Time">Part Time</option> <option value="Contract">Contract</option> </select> </td> <td></td> </tr> <tr> <td height="25" valign="top">Remuneration:</td> <td valign="top"> <select name="remuneration" class="required" id="remuneration"> <option value="" selected></option> <option value="0-5000">0-5000</option> <option value="5000-10000">5000-10000</option> <option value="10000-20000">10000-20000</option> <option value="20000-50000">20000-50000</option> <option value="50000-100000">50000-100000</option> <option value="100000 and above">100000 and above</option> </select> </td> <td></td> </tr> <tr> <td height="25" valign="top">Salary/Wage terms:<span class="required"><font color="#CC0000"></font></span></td> <td valign="top"> <span style="color:red; font: bold 12px verdana; " id="terms" > <select name="terms" class="required" id="terms"> <option value="" selected></option> <option value="hourly">hourly</option> <option value="weekly">weekly</option> <option value="monthly">monthly</option> <option value="other">other</option> </select> </span> </td> <td></td> </tr> <tr> <td height="34" valign="top">Start Date<span class="required"><font color="#CC0000">*</font></span> </td> <td valign="top"> <input name="start_date" id="start_date"> </td> <td></td> </tr> <tr> <td height="21" colspan="2" valign="top"> </td> <td></td> </tr> <tr> <td height="24" valign="top"><strong>Image Verification </strong></td> <td valign="top"> <?php require_once('recaptchalib.php'); echo recaptcha_get_html($publickey); ?> </td> <td></td> </tr> <tr> <td height="7"></td> <td></td> <td></td> </tr> </table> <p align="center"> <input name="submit" type="submit" id="submit" value="Submit Job"> </p> </form> <p align="right"> </p> </td> <td width="196" valign="top"> </td> </tr> <tr> <td colspan="3"> </td> </tr> </table> </body> </html> And here is my jobs table: It is also giving me a duplicate entry error when I use the form again but the primary key (id) is set to auto increment? Any help with this would really be highly appreciated. Thank you PS: please excuse my newb non programmer lingo!
  12. Hello, Could somebody please advise me on the following. Not a "show me how to do it" otherwise I will never learn but reference to what I should be studying to get the following question right.... I would like to know what is the best way to set up a users table if there are more than 1 type of user. For example: a free user that can add profile info and a paying user that can add profile info as well as add comments to a comments table. If the user logs in the free user will not have the option (say a link to add comment page) displayed on their profile page. So basically when you register you can select either free or paying user. Once you are registered, the paying user has the option to add comments from profile page. Now, do I add both types of users to the same users table in the db and set the privileges on the comment table? What should I be looking up to get this right? Thanks in advance for your time. Much appreciated!
  13. Hello Could somebody please advise me on the following. I have a form to upload an image to the server and image name and other form fields to mysql database. It all works fine but I am at a loss as where to add or how to add code for thumbnail creation for the uploaded image. Here is the form: <html> <head> <title>Insert business for sale</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <script type="text/javascript" src="../js/country.js"></script> </head> <body> <table width="100%" border="0" cellspacing="0" cellpadding="5" class="main"> <tr> <td colspan="3"> </td> </tr> <tr> <td width="160" valign="top"><p> </p> <p> </p> <p> </p> <p> </p> <p> </p></td> <td width="732" valign="top"><p> </p> <h3 class="titlehdr">Add details for business for sale here:</h3> Or go back to Admin Panel <a href="admin_main.php">here</a>.<br> <form method="post" action="addcourse.php" enctype="multipart/form-data"> <table width="95%" border="0" cellpadding="3" cellspacing="3" class="forms"> <tr> <td colspan="2" height="49"><font color="#FF0000">Course Name</font><font color="#CC0000">*</font><br> <input name="course" type="text" id="course" size="40"> </td> <td width="4"></td> </tr> <tr> <td colspan="2" height="21"> </td> <td></td> </tr> <tr> <td colspan="2" height="114"><font color="#FF0000">Contact Address (with ZIP)</font><font color="#CC0000">*</font><br> <textarea name="address" cols="40" rows="4" id="address"></textarea> </td> <td></td> </tr> <tr> <td height="21" valign="top" colspan="2"><font color="#FF0000"><b>Company details:</b></font></td> <td></td> </tr> <tr> <td height="59" valign="top" colspan="2"> <textarea name="profile" cols="80" rows="8" id="profile" onkeyup="if (this.value.length > 300) { alert('Character limit has been reached!'); this.value = this.value.substr(0,5); }"></textarea> </td> <td></td> </tr> <tr> <td height="21" valign="top" colspan="2"> </td> <td></td> </tr> <tr> <td height="32" width="125" valign="top"><font color="#FF0000">Contact Person</font></td> <td width="482" valign="top"> <input type="text" name="contact" id="contact"> </td> <td></td> </tr> <tr> <td height="21" colspan="2" valign="top"><font color="#FF0000" size="1">Please select your country/state</font> <font color="#FF0000">*</font></td> <td></td> </tr> <tr> <td height="27" valign="top"> <select id='countrySelect' name='country' onchange='populateState()'> </select> </td> <td valign="top"> <select id='stateSelect' name='state'> </select> <script type="text/javascript">initCountry('PLS'); </script> <td></td> </tr> <tr> <td height="40" valign="top"><font color="#FF0000">City</font></td> <td valign="top"> <input type="text" name="city" id="city"> </td> <td></td> </tr> <tr> <td height="34" valign="top"><font color="#FF0000">Phone</font><font color="#CC0000">*</font> </td> <td valign="top"> <input name="tel" type="text" id="tel"> </td> <td></td> </tr> <tr> <td height="34" valign="top"><font color="#FF0000">Holes</font> </td> <td valign="top"> <input name="holes" type="text" id="holes"> </td> <td></td> </tr> <tr> <td height="34" valign="top"><font color="#FF0000">Par</font> </td> <td valign="top"> <input name="par" type="text" id="par"> </td> <td></td> </tr> <tr> <td height="34" valign="top"><font color="#FF0000">Designer</font> </td> <td valign="top"> <input name="designer" type="text" id="designer"> </td> <td></td> </tr> <tr> <td height="34" valign="top"><font color="#FF0000">Course Distance</font> </td> <td valign="top"> <input name="distance" type="text" id="distance"> </td> <td></td> </tr> <tr> <td height="34" valign="top"><font color="#FF0000">Fairways Grass</font> </td> <td valign="top"> <input name="fairways" type="text" id="fairways"> </td> <td></td> </tr> <tr> <td height="34" valign="top"><font color="#FF0000">Greens Grass</font> </td> <td valign="top"> <input name="greens" type="text" id="greens"> </td> <td></td> </tr> <tr> <td height="34" valign="top"><font color="#FF0000">Website </font></td> <td valign="top"> <input name="web" type="text" id="web" class="optional defaultInvalid url"> <span class="example">http://www.example.com</span></td> <td></td> </tr> <tr> <td height="25" colspan="2" valign="top"> </td> <td></td> </tr> <tr> <td height="34" valign="top"><font color="#FF0000">Email Address:</font><span class="required"><font color="#CC0000">*</font></span> </td> <td valign="top"> <input name="usr_email" type="text" id="usr_email"> </td> <td></td> </tr> <tr> <td valign="top" height="41"><font color="#FF0000">Upload Avatar</font></td> <td valign="top"> <input type="hidden" name="size" value="350000"> <input type="file" name="photo"> </td> <td></td> </tr> <tr> <td height="34"></td> <td></td> <td></td> </tr> <tr> <td height="72" valign="top"> <input TYPE="submit" name="upload" title="Add data to the Database" value="Add Course"/> </td> <td></td> <td></td> </tr> </table> <p align="center"> </p> </form> </td> <td width="196" valign="top"> </td> </tr> <tr> <td colspan="3"> </td> </tr> </table> </body> </html> And here is the php to handle the upload: <?php include "../db connection..."; //This is the directory where images will be saved $target = "market/Thumbs/"; $target = $target . basename( $_FILES['photo']['name']); //This gets all the other information from the form $course=$_POST['course']; $address=$_POST['address']; $profile=$_POST['profile']; $contact=$_POST['contact']; $country=$_POST['country']; $state=$_POST['state']; $city=$_POST['city']; $tel=$_POST['tel']; $holes=$_POST['holes']; $par=$_POST['par']; $designer=$_POST['designer']; $distance=$_POST['distance']; $fairways=$_POST['fairways']; $greens=$_POST['greens']; $web=$_POST['web']; $user_email=$_POST['user_email']; $pic=($_FILES['photo']['name']); //Writes the information to the database mysql_query("INSERT INTO golflist (course,address,profile,contact,country,state,city,tel,holes,par,designer,distance,fairways,greens,web,user_email,photo,date) VALUES ('$course', '$address', '$profile','$contact','$country','$state','$city','$tel','$holes','$par','$designer','$distance','$fairways','$greens','$web','$user_email','$pic',now())") ; //Writes the photo to the server if(move_uploaded_file($_FILES['photo']['tmp_name'], "$target")) { //Tells you if its all ok echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded, and your information has been added to the directory"; } else { //Gives and error if its not echo "Sorry, there was a problem uploading your file."; } ?> I am not looking for someone to do the work for me, just advise me or point me in the direction of code I could integrate with what I already have? Thank you for your time. I do appreciate it!
  14. Hi again, I was wondering if I could please get some advice on the following I was trying. I created a form to insert data into mysql database and all is well in happyland it seems. But I would like to know if it is possible to add an option to the form to upload a picture on the same form and if it is better to upload to a second table or just use the same table. The form was to insert golf course details and display it on a profile page. That seems to be working fine, its just the uploading the image part that has me confused. (better mention, I will be doing all the uploading from what people email me, no end user input) Here is the code I have that inserts the data into the table currently. I apologize if its long. <?php $sql_insert = "INSERT into `golflist` (`name`,`user_email`,`address`,`profile`,`contact`,`country`,`state`,`city`,`tel`,`holes`,`par`,`distance`,`designer`,`fairways`,`greens`,`website`,`date` ) VALUES ('$_POST[name]','$usr_email','$_POST[address]','$_POST[profile]','$_POST[contact]','$_POST[country]','$_POST[state]','$_POST[city]','$_POST[tel]','$_POST[holes]','$_POST[par]','$_POST[distance]','$_POST[designer]','$_POST[fairways]','$_POST[greens]','$_POST[web]' ,now() ) "; mysql_query($sql_insert,$link) or die("Insertion Failed:" . mysql_error()); $user_id = mysql_insert_id($link); ?> <html> <head> <title>Insert business for sale</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <script type="text/javascript" src="../js/country.js"></script> </head> <body> <table width="100%" border="0" cellspacing="0" cellpadding="5" class="main"> <tr> <td colspan="3"> </td> </tr> <tr> <td width="160" valign="top"><p> </p> <p> </p> <p> </p> <p> </p> <p> </p></td> <td width="732" valign="top"><p> </p> <h3 class="titlehdr">Add details for business for sale here:</h3> Or go back to Admin Panel <a href="admin_main.php">here</a>.<br> <form action="insertcourse.php" method="post" name="insertcourse" id="insertcourse" > <table width="95%" border="0" cellpadding="3" cellspacing="3" class="forms"> <tr> <td colspan="2" height="49"><font color="#FF0000">Course Name</font><font color="#CC0000">*</font><br> <input name="name" type="text" id="name" size="40"> </td> <td width="4"></td> </tr> <tr> <td colspan="2" height="21"> </td> <td></td> </tr> <tr> <td colspan="2" height="114"><font color="#FF0000">Contact Address (with ZIP)</font><font color="#CC0000">*</font><br> <textarea name="address" cols="40" rows="4" id="address"></textarea> </td> <td></td> </tr> <tr> <td height="21" valign="top" colspan="2"><font color="#FF0000"><b>Company details:</b></font></td> <td></td> </tr> <tr> <td height="59" valign="top" colspan="2"> <textarea name="profile" cols="80" rows="8" id="profile" onkeyup="if (this.value.length > 300) { alert('Character limit has been reached!'); this.value = this.value.substr(0,5); }"></textarea> </td> <td></td> </tr> <tr> <td height="21" valign="top" colspan="2"> </td> <td></td> </tr> <tr> <td height="32" width="125" valign="top"><font color="#FF0000">Contact Person</font></td> <td width="482" valign="top"> <input type="text" name="contact" id="contact"> </td> <td></td> </tr> <tr> <td height="21" colspan="2" valign="top"><font color="#FF0000" size="1">Please select your country/state</font> <font color="#FF0000">*</font></td> <td></td> </tr> <tr> <td height="27" valign="top"> <select id='countrySelect' name='country' onchange='populateState()'> </select> </td> <td valign="top"> <select id='stateSelect' name='state'> </select> <script type="text/javascript">initCountry('PLS'); </script> <td></td> </tr> <tr> <td height="40" valign="top"><font color="#FF0000">City</font></td> <td valign="top"> <input type="text" name="city" id="city"> </td> <td></td> </tr> <tr> <td height="34" valign="top"><font color="#FF0000">Phone</font><font color="#CC0000">*</font> </td> <td valign="top"> <input name="tel" type="text" id="tel"> </td> <td></td> </tr> <tr> <td height="34" valign="top"><font color="#FF0000">Holes</font> </td> <td valign="top"> <input name="holes" type="text" id="holes"> </td> <td></td> </tr> <tr> <td height="34" valign="top"><font color="#FF0000">Par</font> </td> <td valign="top"> <input name="par" type="text" id="par"> </td> <td></td> </tr> <tr> <td height="34" valign="top"><font color="#FF0000">Designer</font> </td> <td valign="top"> <input name="designer" type="text" id="designer"> </td> <td></td> </tr> <tr> <td height="34" valign="top"><font color="#FF0000">Course Distance</font> </td> <td valign="top"> <input name="distance" type="text" id="distance"> </td> <td></td> </tr> <tr> <td height="34" valign="top"><font color="#FF0000">Fairways Grass</font> </td> <td valign="top"> <input name="fairways" type="text" id="fairways"> </td> <td></td> </tr> <tr> <td height="34" valign="top"><font color="#FF0000">Greens Grass</font> </td> <td valign="top"> <input name="greens" type="text" id="greens"> </td> <td></td> </tr> <tr> <td height="34" valign="top"><font color="#FF0000">Website </font></td> <td valign="top"> <input name="web" type="text" id="web" class="optional defaultInvalid url"> <span class="example">http://www.example.com</span></td> <td></td> </tr> <tr> <td height="25" colspan="2" valign="top"> </td> <td></td> </tr> <tr> <td height="34" valign="top"><font color="#FF0000">Email Address:</font><span class="required"><font color="#CC0000">*</font></span> </td> <td valign="top"> <input name="usr_email" type="text" id="usr_email"> </td> <td></td> </tr> <tr> <td height="34"></td> <td></td> <td></td> </tr> <tr> <td height="116" valign="top"> <input name="insertcourse" type="submit" id="insertcourse" value="Update Table"> </td> <td></td> <td></td> </tr> </table> <p align="center"> </p> </form> </td> <td width="196" valign="top"> </td> </tr> <tr> <td colspan="3"> </td> </tr> </table> </body> </html> I am not looking for somebody to do the work for me, I just need advice or somebody to point me towards a tutorial that covers this....my google keywords seem to be "off par" Thank you again for taking time to read this. I REALLY do appreciate it.
  15. silly me! thanks so much for the help. I do appreciate it. All sorted now.
  16. Hello Phpfreaks, I am trying to do a bit of pagination but I am coming up 1 row short for each page. I could be way off with the code or something simple, after all I am a php toddler. What I am trying to do is with a form where you select country and state, it displays your mysql data according to that selection. For testing puposes I created 13 rows in the table but when I view results it shows 9 on the 1st page and 2 on the 2nd page, leaving out 1 on each page. The column is called company and all 13 rows have data so its not like its showing but just blank rows. Here is the code: <?php include'dbc.php'; if($_GET['page']) // Is page defined? { $page = $_GET['page']; // Set to the page defined }else{ $page = 1; // Set to default page 1 } $max = 10; // Set maximum to 10 $cur = (($page * $max) - $max); // Work out what results to show $getdata = mysql_query("SELECT * FROM sbt WHERE country LIKE '%$country%' AND state LIKE '%$state%' ORDER BY `id` DESC LIMIT $cur, $max") or die(mysql_error()); // select the results $data = mysql_fetch_array($getdata); // get the data while($user = mysql_fetch_array($getdata)) { echo $user['company'] . '<br />'; } $counttotal = mysql_query("SELECT * FROM sbt ") or die(mysql_error()); // select all records $counttotal = mysql_num_rows($counttotal); // count records $total_pages = ceil($counttotal / $max); // dive the total, by the maximum results to show if($page > 1){ $prev = ($page - 1); echo '<a href="?page=' . $prev . '">« Previous</a>'; } for($i = 1; $i <= $total_pages; $i++) // for each page number { if($page == $i) // if this page were about to echo = the current page { echo'<b>' . $i .'</b> '; // echo the page number bold } else { echo '<a href="?page=' . $i . '">' . $i . '</a> '; // echo a link to the page } } if($page < $total_pages){ $next = ($page + 1); echo '<a href="?page=' . $next . '">Next »</a>'; // echo the next page link } ?> Could someone please advise me on my wrongful 1 row short ways Thank you for taking the time to read this. Much appreciated!
  17. Thanks so much for the replies. Exactly what I was looking for! I appreciate it!
  18. Hello all, I am having a problem with a search page I was trying to create. Im sure it is something really simple I am not doing but being php handicapped as I am, it has got me a bit confused. What I am trying to do is, by using three list boxes (country,state,industry) you can see user profiles. For example: you select your country, then your state and then industry and hit search. It then shows you a list of registered users based on those 3 list boxes, but as a link to member_profile.php so you can view the profile. The code I have shows the list of users fine based on the list box criteria, but I am having problems making that data display as a link to the profile page.....maybe I am just going about it all wrong? Here is the code that shows the list of users and seems to work fine, its just the link: <?php include 'dbc.php'; //select which database you want to edit mysql_select_db("users"); $search=$_POST["search"]; //get the mysql and store them in $result //change whatevertable to the mysql table you're using //change whatevercolumn to the column in the table you want to search $result = mysql_query("SELECT * FROM users WHERE country LIKE '%$country%' AND state LIKE '%$state%' AND industry LIKE '%$industry%'"); //grab all the content while($r=mysql_fetch_array($result)) { //the format is $variable = $r["nameofmysqlcolumn"]; //modify these to match your mysql table columns $full_name=$r["full_name"]; //display the row echo "$full_name <br>"; ?> Could anybody put me on the right path for this one. Thanks in advance for the help and I do apologize in advance if this has been posted here before.....searched for it beforehand.
×
×
  • 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.