Jump to content

ignace

Moderators
  • Posts

    6,457
  • Joined

  • Last visited

  • Days Won

    26

Everything posted by ignace

  1. SELECT first_name, last_name How do you know for sure? Just deny the student from college/university?
  2. http://rent-a-dba.net/
  3. It's days not Day plus DELETE * FROM $table WHERE date_created < date_add(CURRENT_DATE, $numdays Day) Is the same as: DELETE * FROM $table
  4. SELECT dt.* FROM documents_table dt LEFT JOIN comments_table ct ON dt.id = ct.document_id WHERE (dt.description LIKE '%$search_term%' OR dt.subject LIKE '%$search_term%' OR ct.comment LIKE '%$search_term%')
  5. Do you want to remove Read More but keep Edit & Delete?
  6. while (list($email) = mysql_fetch_array($result, MYSQL_NUM)) { mail($email, ..) } This sends n-emails, where n equals mysql_num_rows($result)
  7. There is no version that logs in this specific manner as SQL can not know the name (nor username) of the active user only the active account used by MySQL and this is either root or the account assigned to you by your hosting company
  8. tbl_customers (id) tbl_categories (id) tbl_subcategories (id, category_id) tbl_products (id, subcategory_id, price) tbl_products_sizes (id) tbl_products_has_sizes (id, product_id, size_id, quantity) tbl_shops (id) tbl_shops_has_products (shop_id, product_id) tbl_carts (id, session_id, customer_id, product_has_size_id, quantity) Questions that arise: * Do products only show up under a subcategory or also under a category * Do products only show up under one subcategory or under multiple? I assumed they only showed up under one subcategory * Do shops share products? I assumed they did * Note tbl_carts.session_id this refers to session_id() and is used to allow shopping while not logged in, once they login update their cart Note that I based myself on a common approach if your application differs, then this DB will provide trouble along the way as-well. In order for me to create a DB design that will match your application I will need to understand your application's domain (I would be able to answer the above questions myself) one way this can be achieved is through use-cases (or wireframes) but I doubt you have any planning in place
  9. 1. Properly indent your code 2. Learn PHP, you had many meaningless statements if(isset($_POST['submit'])) { $tag_id=$_POST['tag_id']; $color=$_POST['color']; $born=$_POST['born']; $age=$_POST['age']; $sex=$_POST['sex']; $hatch=$_POST['hatch']; $pmom=$_POST['pmom']; $pdad=$_POST['pdad']; $errs = array(); //looking for multiple error possiblities on just the first field // first get rid of whitespace if($tag_id) trim($tag_id); // making sure field not empty if (empty($tag_id)) $errs[] = "You must have a collar tag entry"; //tried strtoupper but that didnt work so went with this if(!preg_match("/[^A-Z0-9]$/s",$tag_id)) $errs[] = "Please use only uppercase A-Z and 0-9 for Collar ID"; //see if enough characters to make entry valid if (($strlen = strlen($tag_id)) < 2 || $strlen > 4) $errs[]=" Collar has to be at least 2 charaters and less than 4 characters"; if (count($errs) == 0) { include("myConnection.php"); mysql_connect("$server", "$username", "$password") or die ('screwed up'); mysql_select_db("$database") or die ("Unable to select database!"); // probably dont need all of these if validation works but // wanted to make sure missing wouldnt throw error $tag_id=mysql_real_escape_string($tag_id); $color=mysql_real_escape_string($color); $born=mysql_real_escape_string($born); $age=mysql_real_escape_string($age); $sex=mysql_real_escape_string($sex); $hatch=mysql_real_escape_string($hatch); $pmom=mysql_real_escape_string($pmom); $pdad=mysql_real_escape_string($pdad); $result = "INSERT INTO myTable (tag_i, color, born, age, sex, hatch, pmom, pdad) VALUES ('$tag_id','$color','$born','$age','$sex','$hatch','$pmom','$pdad')"; mysql_query($result) or die(mysql_error()); echo '<h2>New Entry</h2>', ' <b>Collar Number:</b> $tag_id <br/>', ' Collar Color: $color <br/>', ' <b>Born:</b> $born - $hatch <br/>', ' <b>Age:</b> $age <b>Sex:</b> $sex <br/>', '<br>', 'Parent mother: $pmom <br/>', 'Parent father: $pdad '; } else { $i = 0; $fix = ''; $count = sizeof($errs); while ($i < $count) { $fix .= $errs[$i] . '<br>';//??? ++$i; } echo $fix; } }
  10. htmlentities
  11. Follow these instructions: 1. Start > cmd > ipconfig (probably something like 192.168.x.x) 2. Surf to your router interface (probably 192.168.0.1) 3. Forward your ports so that all incoming traffic on port 80 is routed to your computer (see #1) 4. WampServer > Put Online
  12. SELECT DISTINCT b.name, p.uri FROM books b, pictures p WHERE p.book_id = b.id ORDER BY p.timestamp DESC
  13. Nope they are equal (in results) PROPERTIES.COMMUNITY in (select COMMUNITY from LOCATION_BRIDGE where LOCATION={$location}) Is the same as saying: JOIN properties p ON .. JOIN location_bridge lb ON p.community = lb.community WHERE lb.location = $lid My method is preferred as there is no need to use sub-queries they only make it more complex to understand.
  14. What code do you have on blog? I assume somewhere in that code you invalidate the auth session
  15. If you only need the e-mail you better change: SELECT fname, sname, username, email FROM users where is_guard=1 to: SELECT email FROM users where is_guard=1 now you can: $emails = array(); while (list($email) = mysql_fetch_array($result, MYSQL_NUM)) { $emails[] = $email; } $email_list = implode(',', $emails); // avoids the trailing ,
  16. SET GLOBAL time_zone = <timezone>; -- if something different from SYSTEM or if you SQL server is not hosted on the same server as your PHP SELECT * FROM table WHERE date BETWEEN date_y AND date_x SELECT * FROM table WHERE month(date) = 3 -- March
  17. if($path)) set_include_path($path); if (is_file($filename)) { //or if (is_file(rtrim($path, '/\\') . DIRECTORY_SEPARATOR . $filename))
  18. Bare in mind that donating will by no means get you help any quicker. The chances are that nobody who is likely to help you will even know you donated. Don't you get a flashy banner under your name saying donator or something? I thought you did.
  19. Are you getting any errors? Do you have display_errors = On and error_reporting = E_ALL in your php.ini?
  20. date_diff
  21. If you are in a money wasting mood then by all means donate PS phpfreaks.com provides an IRC-chat #help not sure how many lurkers it has but it should give you an edge in getting you the answer
  22. No it doesn't have to. He explodes the value within the column so something like this will work: $checkboxes = array('value1', 'value2', 'value3', 'value4', ..); // values for your checkboxes $check = explode('-', $row['a_locations']); foreach ($checkboxes as $key => $checkbox) { echo '<input type="checkbox" id="', $checkbox . $key, '" name="a_locations[]" value="', $checkbox, '"', (in_array($checkbox, $check) ? ' checked="checked"' : ''), '>', '<label for="', $checkbox . $key, '">', $checkbox, '</label>'; }
  23. Why you never will beat hackers: http://www.engadget.com/2010/03/09/1024-bit-rsa-encryption-cracked-by-carefully-starving-cpu-of-ele/ http://www.sektioneins.com/en/advisories/advisory-032009-piwik-cookie-unserialize-vulnerability/index.html http://www.sektioneins.com/en/advisories/index.html
  24. $array = array('7', 'bar', 'orange', 'cherry', 'MISS'); print_r(array_rand($array, 3));
  25. ignace

    Help!

    I was not referring to you Rather to the person from the hosting company. It's strange that they don't have an in-house professional that can deal with PHP problems as they are offering PHP hosting..
×
×
  • 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.