Jump to content

m118

Members
  • Posts

    59
  • Joined

  • Last visited

    Never

Everything posted by m118

  1. hello I need to fix code display problem. The code below cause the disorder problem. When I delete the part of it , the code display in the right way. I do not really understand it . The template try to use bx_textarea to display code,so I find the function in it. Finally , I found this function cause the disorder code problem. <?php echo bx_highlight(bx_textarea($view_query_result['jdescription']), $kwd_search);?> if ($char == "<") { $skip=1; } elseif ($char == ">") { $skip=0; } elseif ($char == " ") { $wrap=0; } if ($skip==0) { $wrap=$wrap+1; } function bx_wordwrap($a_str, $a_break_length=75) { $length = strlen($a_str); for ($i=0; $i<=$length; $i=$i+1) { $char = substr($a_str, $i, 1); if ($char == "<") { $skip=1; } elseif ($char == ">") { $skip=0; } elseif ($char == " ") { $wrap=0; } if ($skip==0) { $wrap=$wrap+1; } $res_str = $res_str . $char; if ($wrap>$a_break_length) { $res_str = $res_str." "; $wrap=0; } } return $res_str; } function bx_textarea($text) { return nl2br(preg_replace('/\t/',' ',bx_wordwrap($text, 75))); }//end function bx_textarea($text)
  2. hello This is a database configuration file for PHP JOBSITE. I need to edit it . After I put the mysql_query("SET NAMES 'UTF-8'"); into the program. It is still not working. I do not know why. Please tell me . Thank you very much <?php function bx_db_connect() { global $db_link; $db_link = @mysql_connect ( DB_SERVER, DB_SERVER_USERNAME, DB_SERVER_PASSWORD ); if ( $db_link ) { mysql_query("SET NAMES 'UTF-8'"); if ( ! @mysql_select_db ( DB_DATABASE ) ) return false; return $db_link; } else { return false; } } function bx_db_checkconnection() { global $db_link; $nr_check = 1; $res_ping = mysql_ping( $db_link); while( !$res_ping && $nr_check < 5) { @mysql_close($db_link); @bx_db_connect(); $res_ping = mysql_ping( $db_link) ; if(!$res_ping ) { sleep(2); } $nr_check++; } if(!$res_ping ) { return false; }else{ return true; } } function bx_db_query ( $sql, $execute=true ) { global $db_link,$bx_temp_query, $bx_query_time; $bx_temp_query=$sql; if ($execute) { if (function_exists("mysql_ping")){ bx_db_checkconnection(); } $query_time = microtime(); $query_start = explode(' ', $query_time); $res = @mysql_query ( $sql, $db_link ); $query_end = explode(' ', microtime()); $bx_query_time = number_format(($query_end[1] + $query_end[0] - ($query_start[1] + $query_start[0])), 3); if (DEBUG_MODE=="yes" && $bx_query_time >1) { //write slow query logs: $fp = fopen(DIR_SERVER_ROOT."logs/mysql_slow_query", "a"); fwrite($fp, date('Y-m-d h:i:s')." - Slow query (time: ".$bx_query_time.")\n"); fwrite($fp, $sql); fclose($fp); } return $res; } else { echo "<br /><span style=\"font-size: 12px; color: #FF0000\">".$sql."</span><br />"; } } function bx_db_close () { global $db_link; return @mysql_close ( $db_link ); } function bx_db_num_rows ( $res ) { return @mysql_num_rows ( $res ); } function bx_db_fetch_array ( $res ) { return @mysql_fetch_array ( $res ); } function bx_db_free_result ( $res ) { return @mysql_free_result ( $res ); } function bx_db_error () { global $db_link; $ret = @mysql_error ($db_link); if ( strlen ( $ret ) ) { return $ret; } else { return "Unknown error"; } } function bx_db_fatal_error ( $msg ) { echo "<H2>Error</H2>\n"; echo "<!--begin_error(dbierror)-->\n"; echo "$msg\n"; echo "<!--end_error-->\n"; exit; } function bx_db_data_seek($db_query, $row_number) { $result = @mysql_data_seek($db_query, $row_number); return $result; } function bx_db_insert_id() { global $db_link; $result = @mysql_insert_id($db_link); return $result; } function bx_db_insert($db_table,$db_fields,$db_values) { return bx_db_query("insert into ".$db_table." ($db_fields)"." values ($db_values)"); } ?>
  3. hello I use php jobsite software to create a jobsite. There is a problem. The article can not display in the right way. I have change the meta to the UTF-8. This is the links. I have been working on this problem for one week, so far I have not get a solution. I hope someone know about php jobsite. Thank you very much. http://jobs.enorstar.com/article.php?title=-and-21152-and-25343-and-22823-and-39640-and-26657-and-65306-and-23601--and-19994-and-25351-and-23548-and-20197-and-26381-and-21153-and-2002-6-and-26680-and-24515&article_id=14&auth_sess=e619b48cd50396951e1b8a653e155102&ref=d0c1f49fc9c73798df000c4c9 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> This is database connection file. <?php function bx_db_connect() { global $db_link; $db_link = @mysql_connect ( DB_SERVER, DB_SERVER_USERNAME, DB_SERVER_PASSWORD ); if ( $db_link ) { if ( ! @mysql_select_db ( DB_DATABASE ) ) return false; return $db_link; } else { return false; } } function bx_db_checkconnection() { global $db_link; $nr_check = 1; $res_ping = mysql_ping( $db_link); while( !$res_ping && $nr_check < 5) { @mysql_close($db_link); @bx_db_connect(); $res_ping = mysql_ping( $db_link) ; if(!$res_ping ) { sleep(2); } $nr_check++; } if(!$res_ping ) { return false; }else{ return true; } } function bx_db_query ( $sql, $execute=true ) { global $db_link,$bx_temp_query, $bx_query_time; $bx_temp_query=$sql; if ($execute) { if (function_exists("mysql_ping")){ bx_db_checkconnection(); } $query_time = microtime(); $query_start = explode(' ', $query_time); $res = @mysql_query ( $sql, $db_link ); $query_end = explode(' ', microtime()); $bx_query_time = number_format(($query_end[1] + $query_end[0] - ($query_start[1] + $query_start[0])), 3); if (DEBUG_MODE=="yes" && $bx_query_time >1) { //write slow query logs: $fp = fopen(DIR_SERVER_ROOT."logs/mysql_slow_query", "a"); fwrite($fp, date('Y-m-d h:i:s')." - Slow query (time: ".$bx_query_time.")\n"); fwrite($fp, $sql); fclose($fp); } return $res; } else { echo "<br /><span style=\"font-size: 12px; color: #FF0000\">".$sql."</span><br />"; } } function bx_db_close () { global $db_link; return @mysql_close ( $db_link ); } function bx_db_num_rows ( $res ) { return @mysql_num_rows ( $res ); } function bx_db_fetch_array ( $res ) { return @mysql_fetch_array ( $res ); } function bx_db_free_result ( $res ) { return @mysql_free_result ( $res ); } function bx_db_error () { global $db_link; $ret = @mysql_error ($db_link); if ( strlen ( $ret ) ) { return $ret; } else { return "Unknown error"; } } function bx_db_fatal_error ( $msg ) { echo "<H2>Error</H2>\n"; echo "<!--begin_error(dbierror)-->\n"; echo "$msg\n"; echo "<!--end_error-->\n"; exit; } function bx_db_data_seek($db_query, $row_number) { $result = @mysql_data_seek($db_query, $row_number); return $result; } function bx_db_insert_id() { global $db_link; $result = @mysql_insert_id($db_link); return $result; } function bx_db_insert($db_table,$db_fields,$db_values) { return bx_db_query("insert into ".$db_table." ($db_fields)"." values ($db_values)"); } ?>
  4. The code likes this . 非 320;莫属
  5. I have put it on the web page . It is still not working. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  6. hello I use the a template called job-site. I can add Chinese character into the database, but I can not display all of the information on the web page. there are a litter bit disordered code on the web page. It is not all of the word is disordered code. I have use the this command . mysql_query("SET NAMES 'utf8'"); I do not know why . Please tell me . Thank you very much.
  7. Thank you . Actually, it is working out.
  8. The data can be displayed , but it does not reach the goal.
  9. hello I need write a program related to the mysql database. it need to search begin time and endtime and contractor name. I write a program , it does not work out. Please tell me how to fix it . Begintime and endtime are in the different row. $select1="select * from nt_contract_list where begintime >='2009-08-07' and endtime <='2010-04-30' order by begintime DESC "; The program is not working , Please tell me how to fix it . Thank you very much.
  10. I need write a program. I need turn page program, so I have to use limit and between and commands together. command line select sum(price) price from a group by name limit a, b between c and d . Is it correct ? Thank you very much.
  11. how to set up to save files as UTF-8 without BOM ? I try to display chinese word.
  12. This is the print screem of the program. I did not find the problem. [attachment deleted by admin]
  13. I get an error message on the web page. Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at D:\AppServ\www\mission1\m.php:1) in D:\AppServ\www\mission1\m.php on line 1 I have put the session_start code on the top of the program, but it is not working. Please tell me how to fix it. Thank you very much. <?php session_start(); if(isset($_SESSION['myusername'])) { print "Your session username: ".$_SESSION['myusername']. "<br>"; print "Your session password: ".$_SESSION['mypassword']."<br>"; } else { print "Session does not exist"; } ?>
  14. Is this related to the php version ?
  15. I create a login form , but I do not work well. The web can not redirect to the other page. I get error message . Cannot modify header information - headers already sent by (output started at D:\AppServ\www\mission1\checklogin.php:10) in D:\AppServ\www\mission1\checklogin.php on line 30 Please tell me how to modify the code . Thank you very much. <?php include("connect.php"); $myusername=$_POST['myusername']; $mypassword=$_POST['mypassword']; $tbl_name="members"; $chun="SELECT * FROM $tbl_name WHERE username='$myusername' and password='$mypassword'"; $result1=mysql_query($chun); // Mysql_num_row is counting table row $count=mysql_num_rows($result1); echo "$count"; // If result matched $myusername and $mypassword, table row must be 1 row if($count==1){ // Register $myusername, $mypassword and redirect to file "login_success.php" $_SESSION["myusername"]=$myusername; $_SESSION["mypassword"]=$mypassword; header("location:6.php"); } else { echo "Wrong Username or Password"; } ?>
  16. I have a question. Session_id is unique or not. I see a lot of resource. There is no certain answer. Please tell me. Thank you very much.
  17. I want two custnum is same, I use it. By the way , Can you tell me how to create a unique number ? It can join the database. The two table code CREATE TABLE `income` ( `id` int(6) NOT NULL auto_increment, `subtotal` decimal(7,2) default NULL, `tax` decimal(7,2) default NULL, `total` decimal(7,2) default NULL, `time` date NOT NULL, `email` varchar(50) NOT NULL, `address` varchar(60) NOT NULL, `credit` varchar(50) NOT NULL, `name` char(20) NOT NULL, `month` char(15) NOT NULL, `year` char(10) NOT NULL, `code` char(10) NOT NULL, `method` char(20) NOT NULL, `custid` int(6) NOT NULL, PRIMARY KEY (`id`) ) CREATE TABLE `try` ( `id` int(6) NOT NULL auto_increment, `prodnum` varchar(20) NOT NULL, `quan` int(3) NOT NULL, `custnum` int(6) NOT NULL, PRIMARY KEY (`id`) )
  18. Yes. The table has one auto_increment.
  19. There is no any error message. I checked the database, the data is zero.
  20. I get mysql_insert_id problem. It returns 0. I do not know how to fix it. Please tell me. Thank you very much. <?php session_id(); session_start();?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> </head> <body> <?php include("connection.php"); $subtotal=$_POST['subtotal']; $tax=$_POST['tax']; $total=$_POST['total']; $today=date("Y-m-d"); $email=$_SESSION['email']; $od=mysql_insert_id(); $number=$_POST['number']; $name=$_POST['name']; $month=$_POST['month']; $year=$_POST['year']; $code=$_POST['code']; $method=$_POST['type']; $add1="select * from customer where email='$email'"; $add2=mysql_query($add1); $add3=mysql_fetch_array($add2); extract($add3); $qiu1="INSERT INTO test (oid) VALUES ('$email')"; $qiuzhen=mysql_query($qiu1); $orderid=mysql_insert_id(); $query44="INSERT INTO income (subtotal,tax,total,time,email,address,credit,name,month,year,code,method,custid) VALUES ('$subtotal','$tax','$total','$today','$email','$add1',$number,'$name','$month','$year','$code','$method','$orderid')"; $result=mysql_query($query44); echo "successful!"; $orderid=mysql_insert_id(); echo "$email"; echo "$total"; $sessid=session_id(); $qu="select * from carttemp where sess='$sessid'"; $result=mysql_query($qu); while($w=mysql_fetch_array($result)){ extract($w); $query7="INSERT INTO try (prodnum,quan,custnum) VALUES ('$prodnum','$quan','$custid')"; $iii=mysql_query($query7) or (mysql_error()); } ?> </body> </html>
  21. I want to make sure, the server has php_pdf.dll file.
  22. yes . I want to create pdf file, so I want to try it.
  23. It is working now . I do not know why .
  24. I fix the problem. I remove the number_format.
×
×
  • 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.