Jump to content


  • Posts

  • Joined

  • Last visited

Everything posted by blacknight

  1. for your members security you should allways md5 there passwords $query = "INSERT INTO `members` SET (`username`,`password`) VALUES ('".$username."','".md5($password)."')"; that will insert the info. when you set a field to not null you dont need to set a default value because you have to set the value.
  2. when using joins you have to define every table i think so.. FROM `partners` INNER JOIN `users` would need something like FROM `partners` AS partners INNER JOIN `users` AS users
  3. open your php.ini file find extension=php_mysql.dll extension=php_mysqli.dll make sure they are uncommented no ; infront of them
  4. preg_replace('/.+?({.+}).+/','$1',$json); usualy cleans it up to and stops errors...
  5. 372 has a space "$row['Note'] ['com'][0]" should be "$row['Note']['com'][0]" my bad .... that could be the issue is nto try replacing line 364 with "GROUP_CONCAT( `opa`.`product_options_values` SEPARATOR ‘|’) as com ".
  6. $query = "SELECT `osh`.`comments`, ". "GROUP_CONCAT( DISTINCT CONCAT(`opa`.`product_options_values`)) as com ". "FROM ".TABLE_ORDERS_STATUS_HISTORY." AS osh ". "LEFT JOIN ".TABLE_ORDERS_PRODUCTS_ATTRIBUTES." AS opa ON". " `oap`.`orders_id` = '$row[OrderNumber]' AND `osh`.`orders_id` = '$row[OrderNumber]'". " ORDER BY orders_status_history_id LIMIT 1"; $row['Note'] = $db->getAll($query); echo $row['Note']['comments'] .'|'.$row['Note'] ['com'][0].'|'.$row['Note']['com'][1].'<br>'; that should.. work....
  7. try using this format with wamp $mysql = $wowdb->connect($db_host, $db_user, $db_passwd, $db_name); $db = mysql_select_db($db_name); if(!$mysql) die("Can´t connect to MySql!<br>".mysql_error()." ".mysql_errno()); if(!$db) die("Can´t connect to MySql Database!<br>".mysql_error()." ".mysql_errno());
  8. JSON or http vars or post data can be sent to any page as longa s you know the values they are looking for ... like me from home i can run localhost/updater/u.php?cleany&opt=y&back=Y and it posts to my site telling to to run the script to clean optanize and packup my database .. the more i think about it post vars are the best way to go..
  9. go in to the phpmyadmin fo the db you want to download go to export select al tables and data and check save as file download to your computer open wamp interface /localhost/myadmin/ import and upload the file it may take severl upload attempts to load the entire file depending on the size of the file.
  10. $result = mysql_query( "SELECT ( select `rider`.`total_points` from`rider` WHERE `rider`.`team-name` = `team`.`rider_name` ) AS `rtotal`, `team`.`rider_name`, FROM `teams` AS team LEFT JOIN `rider_stats` AS rider ORDER BY `rtotal` desc) i think this should do what you want... sum the points of all riders on a team and asoc it with 1 team .. then you can loop each team... orderd by `rtotal` desc should give you a full list of all teamd and there total points... with out testing it this is the best i can do rite now ...
  11. $query="select uname, id from user where id = 1";
  12. still not quite understanding .. but heres how to make multidementional arrays... define a var $title = array(); define a key $title['index']=array(); value of a key $title['index']['home'] = 'texthere'; to call echo $title['index']['home'];// returns texthere to the screen hope this helps...
  13. try changing while($rowone = mysql_fetch_array($parent)){ to while($rowone = mysql_fetch_assoc($parent)){ and try agian
  14. befor echo $rowone["menu_name"]; put print_r($rowone); that will give you the values you can call from that query..
  15. what the error you get? whats happaning?
  16. i think i understand Subjects id | name|.. 1 | bobs | x | x Pages subject_id | name |.. if im correct you want to list each catagory with its subcatagories? try this.. while($row = mysql_fetch_array($result)){ echo $row["menu_name"]."<br/>"; $parent = mysql_query("SELECT * FROM `pages` WHERE `subject_id` = '".$row["id"]."' " ,$connection); if(!$parent){ die("connection error : ".mysql_error()); } while($rowone = mysql_fetch_array($parent)){ echo $rowone["menu_name"]; } echo '<br><hr><br>'; } your parent query is failing because you closed $row['id'] when you closed teh where statement this will loop each subject and then list each page for it under it end with a echo '<br><hr><br> so sep them for the nest then you can do your formatting try this i could be wrong...
  17. im using the same web server for windows you are try full formatting my sql $q = "SELECT * FROM `pages` WHERE `subject_id` = '".$row['id']."' ";
  18. change $row = mysql_fetch_array($result1, MYSQL_NUM) && $sql2querynum < '5' to $row = mysql_fetch_row($result1, MYSQL_NUM) && $sql2querynum < '5' but your bigger issue is that you havent set $sql2querynum and $sql2querynum = mysql_numrows($sql2result); to $sql2querynum = mysql_num_rows($sql2result); and try that
  19. verry simple fix any var that has or could have ' in it use this addslashes($varnamehere) ex: SELECT DISTINCT author FROM archives WHERE `title` = '$title' AND `year` = '$year' AND `category` = '$category' AND `group` = '$group' " to SELECT DISTINCT author FROM archives WHERE `title` = 'addslashes($title)' AND `year` = '$year' AND `category` = '$category' AND `group` = '$group' " best bet when adding stuff in to a dabatase allways use addslases() then when displaying use stripslashes() makes life easier i fond
  20. $username="root"; $password="mypassword"; $database="mydatabase"; mysql_connect('localhost',$username,$password); mysql_select_db($database) or die( "Unable to select database"); function drop_empty_tables(){ $tables = mysql_query('SHOW TABLES'); while($table = mysql_fetch_array($tables)){ $table = $table[0]; $records = mysql_query("SELECT * FROM $table"); if(mysql_num_rows($records) == 0){ mysql_query("DROP TABLE $table"); echo "DROP TABLE $table;\n"; } } } drop_empty_tables(); any table on the server the user has rights to with 0 row count will be droped
  21. $file = "SELECT * FROM table WHERE column='$name'"; $file2 = mysql_query($sqlfile); should be $sqlfile = "SELECT * FROM table WHERE column='$name'"; $file2 = mysql_query($sqlfile);
  22. echo '<pre>'; print_r($keys); that what your looking for?
  23. have a look at http://dev.mysql.com/doc/refman/5.0/en/create-trigger.html i dont know much about triggers but this is teh offical doc's
  24. asuming you have connected to both db's and tables try.. t1 external t2 local UPDATE table1 t1, (SELECT member_old_name, member_id FROM t2) AS t2 SET t1.member_id=t2.member_id WHERE t1.usernamex = t2.member_old_name; let me know how you make out..
  25. something like this? <?php echo '<html><head></head><body>'; //check function $messages = 'Database check Return<br> '; function chk_db( $dbhost, $dbname, $dbuser, $dbpass, $prefix='' ) { global $messages; $prefix = $prefix; $dbname = $dbname; if( empty($dbpass) ) { $link_id = @mysql_connect($dbhost, $dbuser); } else { $link_id = @mysql_connect($dbhost, $dbuser, $dbpass); } @mysql_query("SET NAMES 'utf8'"); if( (is_resource($link_id)) && (!is_null($link_id)) && ($dbname != '') ) { if( !@mysql_select_db($dbname, $link_id) ) { @mysql_close($link_id); $table = '( <span style="color:ff0000">DB named '.$dbname.' failed to connect</span> )'; } $messages .= '<span style="color:99ff33">DB '.$dbhost.' Connected '.$table.'</span><br>'; } else { $messages .= '<span style="color:ff0000">DB '.$dbhost.' ('.$dbname.') failed to connect</span><br>'; } return true; } # # now creat an array with the mysql info # for all the databases you need to check... # $array = array( array( 'dbhost' => 'localhost', 'dbuser' => 'root', 'dbname' => 'wowroster', 'dbpass' => '', 'prefix' => '', ), array( 'dbhost' => 'localhost', 'dbuser' => 'root', 'dbname' => 'avg', 'dbpass' => '', 'prefix' => '', ), array( 'dbhost' => 'localhost2', 'dbuser' => 'XXX2', 'dbname' => 'XXXXX2', 'dbpass' => '', 'prefix' => 'blah_2', ), array( 'dbhost' => 'localhost3', 'dbuser' => 'XXX3', 'dbname' => 'XXXXX3', 'dbpass' => '', 'prefix' => 'blah_3', ), ); # # then loop the array to check the databases # and set it so that if one returns false we get a warning... # foreach ($array as $host => $h) { $x = chk_db( $h['dbhost'], $h['dbname'], $h['dbuser'], $h['dbpass'], $h['prefix']); } echo $messages; $message = wordwrap($messages, 70); // Send mail('caffeinated@example.com', 'Db Status', $message); this prints it to the screen and emails a copy as well... also will say if the database in the host is active or not... hope this helps...
  • 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.