brown2005
Members-
Posts
942 -
Joined
-
Last visited
Everything posted by brown2005
-
$domain = 1; $user = 1; SELECT domains_ratings_domain, COUNT( * ) , AVG( domains_ratings_rating ) FROM domains_ratings WHERE domains_ratings_domain = $domain GROUP BY domains_ratings_domain I have this code which selects: domain 1 total number of ratings for domain 1 for all users average rating for domain 1 for all users what I also want to get is the rating that $user=1 has put in the table. Can this be done in the above code? or does it need to be separate? and how would I go about doing this please?
-
echo'<a href="'.$keywords_id.'">'. implode("<br />\n",array_keys($keywords)) .'</a>.'; right i have this which works apart from it does not have the appropiate id for each keyword?
-
that is the idea, so each keyword that comes from the implode is wrapped in the <a></a> tags tried your code above but that does not work causes a server error
-
I would like to implode print implode("<br />\n",array_keys($comments)); into <a href="">implode here</a>
-
$domains_sql = mysql_query("SELECT domains_id, domains_url, keywords_id, keywords_word, domains_comments_comment FROM ( SELECT domains_id,domains_url FROM domains ORDER BY RAND() LIMIT 1 ) as d INNER JOIN domains_comments ON domains_comments_domain = domains_id INNER JOIN domains_keywords ON domains_keywords_website = domains_id INNER JOIN keywords ON domains_keywords_keyword = keywords_id ORDER BY keywords_word ASC") or die (mysql_error()); $num = mysql_num_rows($domains_sql); $current_price = ""; for($i=0;$i<$num;$i++){ $domains_result = mysql_fetch_array($domains_sql); $domains_id = $domains_result['domains_id']; $domains_url = $domains_result['domains_url']; $domains_name = preg_replace('#^https?://www.#', '', $domains_url); $keywords_id = $domains_result['keywords_id']; $keywords_word = $domains_result['keywords_word']; $domains_comments = $domains_result['domains_comments_comment']; if($domains_url != $current_price) { echo $domains_name."<br /><br />"; $current_price = $domains_url; } echo $keywords_word."<br />"; echo $domains_comments."<br />"; } prints out: MS Office domain 1 MS Office domain 1 - part 1 MySQL domain 1 MySQL domain 1 - part 1 PHP domain 1 PHP domain 1 - part 1 Visual Basic domain 1 Visual Basic domain 1 - part 1 and i need it to be: (info from keywords) MS Office MySQL PHP Visual Basic (info from comments) domain 1 domain 1 - part 1
-
thank you very much, this worked giving me the example below, for a website with two keywords: website keyword website keyword so i looked back through my old listings and got some code to display it like website keyword keyword $domains_sql = mysql_query("SELECT domains_id, domains_url, keywords_id, keywords_word FROM ( SELECT domains_id,domains_url FROM domains ORDER BY RAND() LIMIT 1 ) as d INNER JOIN domains_keywords ON domains_keywords_website = domains_id INNER JOIN keywords ON domains_keywords_keyword = keywords_id ORDER BY keywords_word ASC") or die (mysql_error()); $num = mysql_num_rows($domains_sql); $current_price = ""; for($i=0;$i<$num;$i++) { $row = mysql_fetch_array($domains_sql); if($row['domains_url'] != $current_price) { echo $row['domains_url']."<br>"; $current_price = $row['domains_url']; } echo $row['keywords_word']."<br>"; } and also added the ORDER BY keywords_word ASC and it does what I want, presuming the code I added is the best way this task is all complete so thank you very much
-
$domains_sql = mysql_query("SELECT domains_id,domains_url FROM domains ORDER BY RAND() LIMIT 1;"); while($domains_result = mysql_fetch_array($domains_sql)){ $domains_id = $domains_result['domains_id']; $domains_url = $domains_result['domains_url']; $domains_name = preg_replace('#^https?://www.#', '', $domains_url); $keywords_sql = mysql_query("SELECT * FROM domains_keywords,keywords WHERE domains_keywords_keyword=keywords_id AND domains_keywords_website='$domains_id' ORDER BY keywords_word ASC"); while($keywords_result = mysql_fetch_array($keywords_sql)){ $keywords_id = $keywords_result['keywords_id']; $keywords_word = $keywords_result['keywords_word']; echo' <a href="'.$keywords_id.'">'.$keywords_word.'</a>'; } } anyone like to help me write this code better please? thanks in advance
-
$domains_sql = mysql_query("SELECT domains_id,domains_url FROM domains ORDER BY RAND() LIMIT 1;"); that is the first query
-
well what it does, is the first query selects a website. then the following selects all the keywords for that website, so youd get: website keyword 1 keyword 2 keyword 3
-
while($domains_result = mysql_fetch_array($domains_sql)){ $domains_id = $domains_result['domains_id']; $domains_url = $domains_result['domains_url']; $domains_name = preg_replace('#^https?://www.#', '', $domains_url); $keywords_sql = mysql_query("SELECT * FROM domains_keywords,keywords WHERE domains_keywords_keyword=keywords_id AND domains_keywords_website='$domains_id' ORDER BY keywords_word ASC"); while($keywords_result = mysql_fetch_array($keywords_sql)){ $keywords_id = $keywords_result['keywords_id']; $keywords_word = $keywords_result['keywords_word']; echo' <a href="'.$keywords_id.'">'.$keywords_word.'</a>'; } } is this the correct way of doing the above code? or is there a better way?
-
<!DOCTYPE html> <!--[if lt IE 7]><html class="no-js lt-ie9 lt-ie8 lt-ie7"><![endif]--> <!--[if IE 7]><html class="no-js lt-ie9 lt-ie8"><![endif]--> <!--[if IE 8]><html class="no-js lt-ie9"><![endif]--> <!--[if gt IE 8]><!--><html class="no-js"><!--<![endif]--> <head> <meta charset="UTF-8" /> <title></title> <link rel="stylesheet" href="style.css" /> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js"></script> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.js"></script> <script type="text/javascript" src="script.js"></script> <script type="text/javascript"> $(document).ready(function(){ $("#game-details ul").sortable({ opacity: 0.8, cursor: 'move', update: function() { var order = $(this).sortable("serialize") + '&update=update'; $.post("updateList.php", order, function(theResponse){ }); } }); }); </script> </head> <body> <div id="website"> <div id="game-details"> <ul> <?php include("connect.php"); $query = "SELECT id, text FROM dragdrop ORDER BY listorder ASC"; $result = mysql_query($query); $i = 1; while($row = mysql_fetch_array($result, MYSQL_ASSOC)){ $id = stripslashes($row['id']); $text = stripslashes($row['text']); echo' <li id="arrayorder_'.$id.'"> <div class="position">'.$i.'</div> <div class="team">'.$text.'</div> <div class="transfers">transfers</div> <div class="last>last year</div> <div class="clear">wertret</div> </li>'; $i ++; } ?> </ul> </div> <div id="game-info"> <dl class="gameinfo" id="slider1"> <dt>How To Play</dt> <dd> <p>Drag and drop your teams into the order you think they will finish the 2013-2014 Premier League.</p> <p>With each drag and drop your league table is automatically updated.</p> </dd> <dt>Scoring</dt> <dd> <p>You score points based on the number of correct positions you have at the end of the season:</p> <p>1 correct<span>10 pts</span></p> <p>5 correct<span>50 pts</span></p> <p>10 correct<span>100 pts</span></p> <p>15 correct<span>150 pts</span></p> <p>20 correct<span>200 pts</span></p> </dd> </dl> </div> </div> <script type="text/javascript"> var slider1=new accordion.slider("slider1"); slider1.init("slider1",0,"open"); </script> </body> </html> i have the above code which works on www.richardbrown.name where you can drag and drop the left content, but what i want to do is keep the numbers on the left in order after every drop! thanks in advance.
-
I have the code doing what I want, when i tick say the block checkbox it removes blocked results then untick it adds them back. This works for the seen before checkbox two, but I want to combine the two so that if they are both checked will remove blocked and seen before results. Thanks in advance. $(document).ready(function() { $.ajax({ type: "GET", url: "ajax-search.php", success: function(server_response){ $('#results').html(server_response).show(); } }); $("#blocked").click(function(){ if($('#blocked').is(':checked')){ var dataString = 'blocked=1'; }else{ var dataString = 'blocked=0'; } $.ajax({ type: "GET", url: "ajax-search.php", data: dataString, success: function(server_response){ $('#results').html(server_response).show(); } }); }); $("#seen").click(function(){ if($('#seen').is(':checked')){ var dataString = 'seen=1'; }else{ var dataString = 'seen=0'; } $.ajax({ type: "GET", url: "ajax-search.php", data: dataString, success: function(server_response){ $('#results').html(server_response).show(); } }); }); });
-
$(document).ready(function() { $.ajax({ type: "GET", url: "ajax-search.php", success: function(server_response){ $('#results').html(server_response).show(); } }); $("#blocked").click(function() { var dataString = 'blocked=1'; $.ajax({ type: "GET", url: "ajax-search.php", data: dataString, success: function(server_response){ $('#results').html(server_response).show(); } }); }); }); I have the above code which works fine.. the results are loaded up on the load of the website. Then when I tick the checkbox it takes away results that have been blocked, but what i wanna do is when i on tick the box to remove the blocked=1 and then get the results. thanks in advance.
-
why does this not go to registration-process.php
brown2005 replied to brown2005's topic in Javascript Help
I have attached my jquery It all works fine. checks username and email in mysql.. but the submit button doesnt go to register-process.php when everything is ok. any ideas please? [attachment deleted by admin] -
$(document).ready(function(){ var form = $("#register-form"); var username = $("#username"); var username_error = $("#username_error"); username.blur(validateName); username.keyup(validateName); var email = $("#email"); var email_error = $("#email_error"); email.blur(validateEmail); email.keyup(validateEmail); var password = $("#password"); var password_error = $("#password_error"); password.blur(validatePassword); password.keyup(validatePassword); var password_confirm = $("#password_confirm"); var password_confirm_error = $("#password_confirm_error"); password_confirm.blur(validatePasswordConfirm); password_confirm.keyup(validatePasswordConfirm); form.submit(function(){ if(validateName() & validateEmail() & validatePassword() & validatePasswordConfirm()) return true else return false; }); function validateName(){ if(username.val() == ''){ username_error.html('<span class="is_not_available">Please enter a username.</span>'); return false }else{ if(username.val().length < 5){ username_error.html('<span class="is_not_available">Username must be a minimum of 5 characters.</span>'); return false }else{ username_error.html('<img src="images/loading.gif" /> Checking...'); var username1 = $('#username').val(); $.post("check_username.php", { username: username1 }, function(result){ if(result == 1){ $('#username_error').html('<span class="is_available">' +username1 + ' is available.</span>'); return true }else{ $('#username_error').html('<span class="is_not_available">' +username1 + ' is not available.</span>'); return false } }); } } } function validateEmail(){ if(email.val() == ''){ email_error.html('<span class="is_not_available">Please enter a email.</span>'); return false }else{ email_error.html('<span class="is_not_available"></span>'); return true } } function validatePassword(){ if(password.val() == ''){ password_error.html('<span class="is_not_available">Please enter a password.</span>'); return false }else{ password_error.html('<span class="is_not_available"></span>'); return true } } function validatePasswordConfirm(){ if(password_confirm.val() == ''){ password_confirm_error.html('<span class="is_not_available">Please enter a password confirmation.</span>'); return false }else{ password_confirm_error.html('<span class="is_not_available"></span>'); return true } } }); the above code does not go to my register-process.php when all ok, but if i take out the below it does... var username1 = $('#username').val(); $.post("check_username.php", { username: username1 }, function(result){ if(result == 1){ $('#username_error').html('<span class="is_available">' +username1 + ' is available.</span>'); return true }else{ $('#username_error').html('<span class="is_not_available">' +username1 + ' is not available.</span>'); return false }
-
hi i have created a login form. and a login-process form... the login form currently has the following jquery attached $(document).ready(function() { $('#btn-submit').click(function() { $(".error").hide(); var hasError = false; var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/; var emailblockReg = /^([\w-\.]+@(?!gmail.com)(?!yahoo.com)(?!hotmail.com)([\w-]+\.)+[\w-]{2,4})?$/; var emailaddressVal = $("#email").val(); if(emailaddressVal == '') { $("#email").after('<span class="error">Please enter your email address.</span>'); hasError = true; } else if(!emailReg.test(emailaddressVal)) { $("#email").after('<span class="error">Please enter a valid email address.</span>'); hasError = true; } var passwordVal = $("#password").val(); if(passwordVal == '') { $("#password").after('<span class="error">Please enter your password.</span>'); hasError = true; } if(hasError == true) { return false; } }); }); now i would also like to add whats in the login-process.php $login_sql = mysql_query("SELECT * FROM members,people,people_emails WHERE members_person=people_id AND people_emails_person=people_id AND people_emails_email='$email' AND members_password='$password'"); if(mysql_num_rows($login_sql)>0){ echo"yes ok"; }else{ echo"Email and/or password do not match"; } into the jquery check to check before submiting.. and then process an error on the form when email or password dont match.
-
if exsists use id if not insert and use id.
brown2005 replied to brown2005's topic in PHP Coding Help
is how I have wrote the code the best/fastest way of doing it? or is there a better way? -
if exsists use id if not insert and use id.
brown2005 replied to brown2005's topic in PHP Coding Help
$postedname = $_POST['name']; $name = mysql_query("SELECT names_id, names_name FROM names WHERE names_name='$postedname'"); while($row = mysql_fetch_array($name)){ if ( mysql_row_count($name) == 0 ) { mysql_query("INSERT INTO names(names_id,names_name) VALUES('','$postedname')"); $insert_name = mysql_insert_id(); }else{ $insert_name = $row['names_id']; } } then $insert_name would go into the people table -
if exsists use id if not insert and use id.
brown2005 replied to brown2005's topic in PHP Coding Help
what would be easier? I will have the registration form.. then on submit will go to register-process.php which sets up the registration. -
i have two tables.... 1) people people_id people_name 2) names names_id names_name now when someone enters their name on the register form and process i want to check if the name is in the names table and if so use that id as people_name in the people table, else insert the new name in the names table and use the id.
-
Sessions between websites I own on same server.
brown2005 replied to brown2005's topic in PHP Coding Help
ok, how do I do this please? -
Sessions between websites I own on same server.
brown2005 replied to brown2005's topic in PHP Coding Help
I have my own dedicated server, and will have numerous websites on this, who access the same database. -
Sessions between websites I own on same server.
brown2005 replied to brown2005's topic in PHP Coding Help
Right, I am having a nightmare trying to find information that explains how to do this properly. Please can someone help.. if(mysql_num_rows($login_sql) == 1){ session_regenerate_id(); $login_member = mysql_fetch_assoc($login_sql); $_SESSION['SESS_ID'] = session_id(); $_SESSION['SESS_MEMBER_ID'] = $login_member['members_id']; $_SESSION['SESS_FIRST_NAME'] = $login_member['firstnames_name']; $_SESSION['SESS_LAST_NAME'] = $login_member['surnames_name']; session_write_close(); right that logs people in fine. and displays the four fields on the home page. Now I want to jump from the login website. www.loginhere.co.uk to the website www.website1.co.uk how is the best way to do this. Thanks -
PHP Mail works on shared but not on my dedicated server
brown2005 replied to brown2005's topic in PHP Coding Help
thats a good question, I am led to believe it has. but I would have to check with the host. $to = 'rberbe2002@msn.com'; $subject = 'the subject'; $message = 'hello'; $headers = 'From: webmaster@example.com'; mail($to, $subject, $message, $headers); header("location: http://www.website.com/index.php?page=home&action=register"); thats what I have in my registration process php file. it does everything. just I do not recieve the mail. -
Hi, I have $to = 'rberbe2002@msn.com'; $subject = 'the subject'; $message = 'hello'; $headers = 'From: webmaster@example.com'; mail($to, $subject, $message, $headers); which works fine on a shared hosting website I have, but not on a website I have on my dedicated server. Any ideas or suggestions please?