Jump to content

jazzman1

Staff Alumni
  • Posts

    2,713
  • Joined

  • Last visited

  • Days Won

    12

Everything posted by jazzman1

  1. First of all, never ever run a query string in a loop. Take a look at this -> http://forums.phpfreaks.com/index.php?topic=363815.msg1722467#msg1722467 Secondly, if you're using mysql_set_charset('utf8',$link);, you have to be sure the database collation is utf8_general_ci (I prefer this). In your script you can put after $db_selected this piece of code: $db_selected = mysql_select_db("3", $link); mysql_query("SET NAMES UTF8");
  2. url: "ths.php" to url: "ths.php?" B/s you're using a GET method
  3. It's a html problem, you're missing to close a html label tag. Try, <form method="post" action="/plugins/fancybox/source/bookings.php"> <label>Show:</label> <select name="show"> <option value="Tiptoe Through The Tombstones">Tiptoe Through the Tombstones</option> </select><br> <label>Performance:</label> <select name="performance"> <option value="27th">Thursday 27th Sept 2012 - 8pm</option> <option value="28th">Friday 28th Sept 2012 - 8pm</option> <option value="29th">Saturday 29th Sept 2012 - 8pm</option> </select><br> <label>Number of tickets:</label> <select name="number_of_tickets"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> <option value="10+">More than 10</option> </select><br> <input name="first_name" placeholder="First name" type="text" /><br> <input name="last_name" placeholder="Last name" type="text" /><br> <input name="email" placeholder="Email address" type="" /><br> <input name="email_confirm" placeholder="Confirm your email address" type="" /><br> <input name="phone_number" placeholder="Contact phone number" type=""/><br> <button type="submit" name="sub_booking" value="send">Send</button> </form>
  4. Is it a windows or Linux machine?
  5. A little mistake, u.PostID to w.PostID Sorry about that
  6. Try, $query = " SELECT m.msg_id, m.uid_fk, m.message, m.ToID, m.created, m.uploads FROM messages m JOIN Users_WallPosts_Hide w ON m.msg_id = u.PostID JOIN Users_Friends f ON m.uid_fk = f.FriendID WHERE w.Hidden IS NULL OR f.Level = 1 ORDER BY m.msg_id DESC ";
  7. I've got "Hello" copy/paste your code. Which editor you're using and what kind of encoding type use to save the files?
  8. PS. The last id # 6, I was added it, just to check whether the query return 2 last results and forgot to delete it. Sorry about it
  9. Yep, this will work with one table and an unique id, but the query is a little complex: Take a look at example: +----+---------+-----------------+------------+ | id | post_id | comment | date | +----+---------+-----------------+------------+ | 1 | 1 | Hi there | 1312323443 | | 2 | 1 | How are you | 131232454 | | 3 | 1 | How are you Jim | 1312342454 | | 4 | 2 | How are you | 131232454 | | 5 | 2 | How are you | 131232454 | | 6 | 1 | New comment | 1234245 | +----+---------+-----------------+------------+ SELECT `c`.`id`, `c`.`comment`, FROM_UNIXTIME(`date`) as `timeDate` FROM `comments` `c` WHERE `c`.`id` IN ( SELECT MAX(`c1`.`id`) FROM `comments` `c1` WHERE `c`.`post_id` = `c1`.`post_id` ) OR`c`.`id` IN ( SELECT MAX(`c1`.`id`) FROM `comments` `c1` WHERE `c`.`post_id` = `c1`.`post_id` AND `c1`.`id` NOT IN ( SELECT MAX(`c2`.`id`) FROM `comments` `c2` WHERE `c1`.`post_id` = `c2`.`post_id` ) ) ORDER BY `c`.`post_id`, `c`.`id` RESULT: +----+-----------------+---------------------+ | id | comment | timeDate | +----+-----------------+---------------------+ | 2 | How are you | 1974-02-27 16:27:34 | | 3 | How are you Jim | 2011-08-02 23:34:14 | | 4 | How are you | 1974-02-27 16:27:34 | | 5 | How are you | 1974-02-27 16:27:34 | +----+-----------------+---------------------+
  10. @Jesi, Whiskey...Tango...Foxtrot not belongs to Europe I say - "love is all around"
  11. Ah...., that's different. You got it. Now you have a unique id for each record, that's why I said "to redesign a database structure"
  12. He can not return any values in the way he wrote above, that's why I said "is absolutely wrong". I've never said that return true or return false is an wrong idea.
  13. Perhaps, you have an error somewhere in your script. Copy/paste Barand's code and tell us what a result you get it. $date_created = '2012-08-28'; $date_due = date('Y-m-d', strtotime("+30 days $date_created")); echo $date_due ; //---> 2012-09-27
  14. I'm 100% sure that you don't have an idea what you're doing, right?
  15. Try, SELECT submission_vote_submission_number FROM `submission_votes` WHERE submission_vote_account_number = '1' GROUP BY `submission_vote_submission_number` HAVING `submission_vote_timestamp`= MAX(`submission_vote_timestamp`); Why are you using only one table? Use both, join them and make the query much more flexible.
  16. I don't know why @ nimishprabhu is posted this, but it's absolutely wrong: function dbconn($strHostName, $strDbName, $strUserName, $strPassword) { mysql_connect($strHostName, $strUserName, $strPassword) or return false; mysql_select_db($strDbName) or return false; return true; } If, you want return true or false of both functions, you can put all together in an ternary operator. Example function dbconn($strHostName, $strDbName, $strUserName, $strPassword) { return (mysql_connect($strHostName, $strUserName, $strPassword) && mysql_select_db($strDbName)) ? true : false; For sure instead of false , you can return mysql_error() function or anything you want. function dbconn($strHostName, $strDbName, $strUserName, $strPassword) { return (mysql_connect($strHostName, $strUserName, $strPassword) && mysql_select_db($strDbName)) ? true : mysql_error(); var_dump(ddconn());
  17. Just add one more statement to compare current unixtimestamp to last date record.
  18. You need to redesign a database structure! About your question: SELECT `post_id`,`comment`, FROM_UNIXTIME(`date`) as `timeDate` FROM `Comments` HAVING(`timeDate`) <> FROM_UNIXTIME(1312342454)
  19. return (mysql_connect($strHostName, $strUserName, $strPassword)) ? true : false;
  20. Unless I'm missing something, the OP doesn't want to update all entries. That's why we suggested the WHERE clause be added. Ah, you are right. I'm just translating this sentence wrong to my language.
  21. Hmm...where are you getting that quote from? http://dev.mysql.com/doc/refman/5.0/en/update.html
  22. Guys, did you read a post of OP ? About а WHERE CLAUSE:
  23. So, between $query and $result variables in updated_maint.php, put this piece of code and give back a result, also add a mysql_error() function to the result variable. $query = "UPDATE service_info SET `date_next_maint`='$date_next_maint', `issues_reported`='$issues_reported', `date_reported`='$date_reported', `scheduled_service_date`='$scheduled_service_date', `service_performed`='$service_performed', `date_service_performed`='$date_service_performed', `date_of_followup`='$date_of_followup',`service_in_progress`='$service_in_progress', `date_return_use`='$date_return_use', `time_return_use`='$time_return_use', `issues_nonrepairable`='$issues_nonrepairable', `date_nonrepairable_issues`='$date_nonrepairable_issues', `comments` ='$comments'"; echo '<pre'.print_r($_POST, true).'</pre>'; echo $query; $result = mysql_query($query, $connection) or die(mysql_error());
  24. You said in post # 4 - it didn't work. Have you tried to loop the content? Post the script that you used before. EXPLAIN `RequirementTypes` and EXPLAIN `OrderTicketRequirements` are not just regular words. Explain is a sql statement, if you want to see the result running it in your mysql client application.
  25. Ah, it's a wordpress template system. If you don't understand what the functions (code) does, don't touch it at all! You could use javascript to remove this div only from this page, but it's too ugly
×
×
  • 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.