Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- this works ---->>>
- function good_query($string, $debug=0)
- {
- mysql_connect("127.0.0.1", "root", "thanksrob") or die(mysql_error());
- mysql_select_db("oxwall2") or die(mysql_error());
- if ($debug == 1)
- print $string;
- if ($debug == 2)
- error_log($string);
- $result = mysql_query($string);
- if ($result == false)
- {
- error_log("SQL error: ".mysql_error()."\n\nOriginal query: $string\n");
- // Remove following line from production servers
- die("SQL error: ".mysql_error()."\b<br>\n<br>Original query: $string \n<br>\n <br>");
- }
- return $result;
- }
- function good_query_table($sql, $debug=0)
- {
- // this function require presence of good_query() function
- $result = good_query($sql, $debug);
- $table = array();
- if (mysql_num_rows($result) > 0)
- {
- $i = 0;
- while($table[$i] = mysql_fetch_assoc($result))
- $i++;
- unset($table[$i]);
- }
- mysql_free_result($result);
- return $table;
- }
- this also works -------->>>
- $hostDb='mysql:host=127.0.0.1;port=3306;dbname=oxwall2';
- $user='root';
- $password='thanksrob';
- $ZTH = $DBH -> prepare( "INSERT INTO bot SET id=:id, bot=:bot, username=:user, port=:port, pass=:botpass ON DUPLICATE KEY UPDATE id=:id, bot=:bot, username=:user, port=:port, pass=:botpass");
- $what = OW::getUser()->getUserObject()->getUsername();
- $bot = "bnc";
- $ZTH->bindParam(':id', $num, PDO::PARAM_STR);
- $ZTH->bindParam(':bot', $bot, PDO::PARAM_STR);
- $ZTH->bindParam(':user', $what, PDO::PARAM_STR);
- $ZTH->bindParam(':port', $port, PDO::PARAM_STR);
- $ZTH->bindParam(':botpass', $pass, PDO::PARAM_STR);
- $ZTH->bindParam(':parameter', $what, PDO::PARAM_STR);
- $ZTH -> execute();
- $result = $ZTH -> fetch();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement