Jump to content

Muddy_Funster

Members
  • Posts

    3,372
  • Joined

  • Last visited

  • Days Won

    18

Everything posted by Muddy_Funster

  1. Let's see your table structure, also you do realise you posted this in the MS SQL forum and not the MySQL one right?
  2. changing this: $data = mysql_query("SELECT * FROM tc_tool.forms WHERE upper(".$field.") LIKE'%$find%'") or die(mysql_error()); to this: $sql = <<<SQL SELECT * FROM tc_tool.forms WHERE ( UPPER('$field') LIKE '%$find%' ) SQL; $result = mysql_query($sql) or die(mysql_error())."<br>----------------<br>$sql"); will help you diagnose the problem with the query. It's looking like $field is empty. Also, this code doesn't look like what your description said you wanted your search to perform. As for not being allowed to post on other forums....we're here to help, having that rule would be somewhat counter productive. It's all about getting the solution to a problem, whether it be here or anywhere else.
  3. search the forum or google for "pagination"
  4. another thing that would help would be to see the few lines either side of that one in the error, sometimes the problem isn't in the code listed in the error, which is why the error message uses the word near in stread of at.
  5. isnt there a sticky about this problem?
  6. so member_awards = member_id | ac1 | ac2 | ac3 | ac4 | ac5 | ac6 | ac7 | ... | ac20 | 1 | 1 | 0 | 1 | 0 | 1 | 1 | 1 | ... | 1 | and awards = award_id | award_description | ac1 | Biggest Muppet | ac2 | Worlds Best God | ac3 | Zealot of the Day | ... and you want to display 5 awards per member relating the column name from one table to the field value in another to display "Jim has recieved : award1, award20, award5, award6, award7". is that the basics of it?
  7. mysqldump --user=myusername --password=mypassword mydatabase > /home/mydirectory/sql_backups/DUMPFILE.SQL should work.
  8. "primary" is a mySQL reserved word (used in assigning a key, like primary key and forign key), so it's getting upset. use backticks around the word to let MySQL know your not messing with it out of badness, and it should forgive you.
  9. Try using this, I have only sampled the first select group, but it should be easy enough to work out from that <?php function buildMenu($value){//going to use this function to build the option list if(!empty($value)){ $output = "<option value =\"$value\">$value</option>\n"; return $output; } } $query = "SELECT landen.landnaam, periode.Periode, categorien.categorie FROM landen, periode, categorien"; $reusult = mysql_query($query) or die (mysql_error())."<br>------------------<br>$query"); while ($row = mysql_fetch_assoc($result)){ $landMenu[] = buildMenu($row['landen']); $periodMenu[] = buildMenu($row['periode']); $catagorieMenu[] = buildMenu($row['categorie']); } //..... echo "<select name=\"landname\" id=\"landnaam\">"; echo "<optgroup label=\"Landen\">"; foreach($landMenu as $key){ echo $landMenu[$key]; } echo "</optgroup></select>"; //.......
  10. what about this? function emailExistsPlayers($email){ $query = <<<QUERY SELECT count(emailCount) as emailTotal FROM ( (select email as emailCount FROM managers WHERE email='$email') UNION (SELECT email as emailCount FROM players WHERE email='$email') ) AS emailTbl QUERY; $result = mysql_query($query) or die (mysql_error()); $row = mysql_fetch_assoc($result); if ($row['emailTotal'] >= 1){ $return = true; } else{ $reurn = false; } return $return; }
  11. let's see what you've got and where it's going wrong
  12. You should really focus on getting the information indo a much more managebale format. There is no consistancy in that file layout, so getting something to work on that test data may not help on the actual full file, or on future data. First find a consistant format to store the information in and then worry about coding a script to extract it (I suggest xml if databases arn't your thing).
  13. Use a SELECT COUNT(*) and GROUP BY productname
  14. Get a new teacher! On the plus side of things, if this is just a classroom project, you can walk away from it once it's complete.
  15. UPDATE syntax is very different to INSERT syntax. and yes, you MUST use a WHERE in an update, or it will update every value in that field. INSERT : INSERT INTO tableName (field1, field2, field3, field4) VALUES ('value1', 'value2', 'value3', 'value4') UPDATE : UPDATE tableName SET field1='value1', field2='value2', field3='value3', field4='value4' WHERE (condition=met)
  16. yeah, I didn't know about the ctype_ either, deffinate bookmark on that one. as an afterthought, I did get my version of the code to work , but as it's not got the checks in place that xyph's does, and is therefor not as robust, I'll just leave it.
  17. As MySQL is a relational database you don't need to. You can use your memberID column to relate the login table to the information table, this reduces whats called redundant data. You already have the password and the user name stored in one talbe, there is no sense storing it in another one too. All you need is to include a refference field (also called a relational field) in each table that can be used to match the records in one to the other. Using your memberID PK from your member table and adding a memberID field to your memberdetails table will let to match the details to the member according to each members unique memberID. This saves storing the username and password in multiple tables.
  18. right, making sense of it now, this should look better: if(isset($_POST['submit'])) { foreach ($_POST as $k => $v){ if($v == '1'){ $id[] = $_POST[$k+1]; } } $ctx = new comment; foreach ($id as $x){ $ctx->commentdelete($x); } header('Location:admin.php'); }
  19. ok, can I see a sample form your POST array as well, this isn't as obvious as it first looked
  20. I can't find your image, so I don't know what the error is. Guessing it could be a "Notice: Undifined Constant dob assuming 'dob' ..." because I forgot to put the single quotes around the array key for $_POST['dob'] (you'll see it's all read in the code I psted, rather than changing the dob part to blue like the rest of them.) I don't understand what your are asking about "giving" a password. If you already have a table with user information in it, why are you making another one?
  21. and what does your var_dump $ids look like in comparison?
  22. the full message please? line number helps on these things.
×
×
  • 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.