Jump to content

gurroa

Members
  • Posts

    87
  • Joined

  • Last visited

    Never

About gurroa

  • Birthday 07/13/1981

Contact Methods

  • Website URL
    http://neworder.gurroa.cz
  • ICQ
    75129856

Profile Information

  • Gender
    Male
  • Location
    Czech republic, Usti nad Orlici

gurroa's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Ok, try this: http://php.gurroa.cz/topics.php <?php mysql_connect('localhost', '*******', '******'); mysql_select_db('gurroa'); ?> <html> <body> <form name="test" method="post" action="topics.php"> Pick topic id:<br /> <input type="text" name="topic_id" /> <input type="submit" value="show" /> </form> <br /> <? if (isset($_POST['topic_id'])) { $id = $_POST['topic_id']; $que = mysql_query("SELECT * FROM topics WHERE ( (topics = '$id') or (topics like '$id-%') or (topics like '%-$id') or (topics like '%-$id-%') ) "); if (mysql_num_rows($que) > 0) { echo 'Topics with topic_id '.$id.'<br />'. '<table>'. '<tr><th>ID</th><th>Topics IDs</th></tr>'; while($row = mysql_fetch_assoc($que)) { echo '<tr><td>'.$row['id'].'</td><td>'.$row['topics'].'</td></tr>'; } echo '</table>'; } else { echo 'Now topics were found!'; } } ?> </body> </html>
  2. lets explain why this mysql_query("SELECT * FROM tbl WHERE field IN (".implode(',',$myvar)."); will never work if field value will be "42-32-4" because WHERE '42-32-4' in (4) will always fail...
  3. My solution is really for your problem... :-)
  4. gurroa

    Hi Guys

    select FIELDWITHPRODUKTNAME, count(FIELDWITHPRODUKTNAME) from YOURTABLE group by FIELDWITHPRODUKTNAME, FIELD1, FIELD2, FIELD3... all field identifing a duplicate
  5. How about this? SELECT * FROM users where groupid = 2 or groupid = 4 group by userid
  6. Solution: mysql_query("SELECT * FROM tbl WHERE ( (fieldArray = '$myvar') or (fieldArray like '$myvar,%') or (fieldArray like '%,$myvar') or (fieldArray like '%,$myvar,%') ) "); This all because of this example: lets $myvar become 1 now you want all records from your table with this fieldArray values "1", "1,42,45", "45,1,42", "42,45,1"
  7. I would do it in different way: First count winnings and loosings: $arteam = array(); $query = mysql_query('select team_id from teams order by team_id'); while($row = mysql_fetch_array($query)) { $arteam[$row['team_id']] = array( 'won' => 0, 'lost' => 0 ); } $query = mysql_query('select winner, team_id_1, team_id_2 from matches'); while($row = mysql_fetch_array($query)) { $tm1id = $row['team_id_1']; $tm2id = $row['team_id_2']; if ($row['winner'] == $tm1id) { $arteam[$tm1id]['won'] += 1; $arteam[$tm2id]['lost'] += 1; } else { $arteam[$tm1id]['lost'] += 1; $arteam[$tm2id]['won'] += 1; } } reset($arteam); while(list($id, $wonlostarray) = each($arteam)) { mysql_query(sprintf(" update teams set games_won = %d, games_lost = %d WHERE team_id = %d ", $id, $wonlostarray['won'], $wonlostarray['lost'] )); }
  8. As written in the manual: resource mysql_query ( string $query [, resource $link_identifier ] ) So try this: $result = mysql_query($query, $dbc) or better (if you have only one connection): $result = mysql_query($query);
  9. You get your warning because of definition of mysql_affected_rows() function: int mysql_affected_rows ([ resource $link_identifier ] ) If you got no echo statements it could mean that php stop on error... Try this one: <?php $DBConnect = mysql_connect("localhost", "root"); if(isset($_POST['submit'])) { mysql_select_db("dietetics", $DBConnect) or die(mysql_errno() . ": " . mysql_error() . "<br>"); $delete = sprintf("delete from members where id = '%s'", isset($_POST['name']) ? $_POST['name'] : null ); $result = mysql_query($delete); if (mysql_affected_rows() > 0) { echo "The row has been deleted, successfully"; } else { echo "No rows have been deleted"; } } ?> ...
  10. Syntax error on line 39 (= instead of ==) if(value==null || value=='') Syntax error on line 81 (: instead of ; ) chapter.focus(); Syntax error on line 103 (missing end of if statement) if(required(zip, 'Please enter your zip code.')==false) Syntax error on line 115 (missing end of if statement) if(required(ctitle, 'Please enter your title.')==false) Syntax error on line 57 (dotpos instead of fotpos) if(apos<1 || fotpos-apos<2) I think that's all.
  11. You have to call setTimeout in the same way you've called animatePath for the first time. Considering that setTimeout will call it's function from the global scope. Maybe if you post bigger part of your script...
  12. echo Date("F", strtotime("+1 month", strtotime(Date("Y-m-01")) ));
  13. function f($x) { return $x > 0 ? 1 : 0; } function f2($x) { return floor(abs($x / abs($x+0.00000001)+0.001)); }
  14. You will need more scripts to include in your page. See http://demos.mootools.net/Tips docs references.
  15. <a href="javascript:q_search.submit();">Search</a>
×
×
  • 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.