Jump to content

gongpex

Members
  • Posts

    360
  • Joined

  • Last visited

Posts posted by gongpex

  1. Hello everyone,

     

    today I test to record data on mysql using this code :

    mysql_query("insert into member           (m_user,m_pass,m_name,m_email,m_phone,m_cell,m_address,m_address2,m_country,m_city,m_join,m_security,m_secure,m_post)             values		   ('$u_user','$u_pass','$u_name','$u_email','$u_phone','$u_cell','$u_address','$u_address2','$u_country','$u_city','$u_join','$u_security','$secure','$u_post')");

    this code work well when I use mysql previous version mysql-essential-5.1.24-rc-win32.msi (32 bit) for windows.

     

    but when I change mysql (same version) but 64 bit for windows, it won't to record.

     

    I had tried using phpmyadmin using insert into it's successful to record data.

     

    Q : Is different bit can affects on syntax?

     

    my specification : Apache24 (32 bit) win

    : php 5.3.0

    : phpmyadmin 3.4.3.1-all language

    : mysql-essential-5.1.73-winx64.msi

     

    note : this code had connect to database using code :

    $host = "localhost"; $user = "root"; $pass = "12345678"; $dtb = "mysql"; $connect = mysql_connect($host,$user,$pass); $db = mysql_select_db($dtb,$connect);

    please help me

     

    Thanks

     

     

  2. Hello everyone,

     

    today I test to use url rewrite on .htaccess file after installation php and all of web need,

     

    I try using simple url rewrite like :

    RewriteEngine OnRewriteRule ^test.php  test2.php [NC]

    then I open my browser and type : localhost/test.php.

     

    this link is open but didn't rewrite to localhost/test2.php

     

    Q : Is there some mistake/lack configuration on http.conf at apache? or this code rewrite that wrong?

     

    please help

     

    thanks

     

     

  3. When you changed your php.ini to point to the mysqli.dll, did you change your code to use

     

    yes, I had change it like this :

    <?php$host = "localhost";$user = "root";$pass = "abcdefgh";$database = "test";$connect = mysqli_connect($host,$user,$pass);$db = mysqli_select_db($database,$connect);if($db) { echo success; } else { echo failure;}?>

    but code on above didn't shown anything (display blank page on browser) like I mention before.

     

    What PHP version are you using by the way?

     

    my PHP version is 5.3.0

     

    Q : Btw, Is some php version not support mysqli?

     

    please help

     

    thanks

  4. Hello everyone,

     

    today after configuration php.ini

     

    I tried to connect mysql through PHP using this code :

    <?php$host = "localhost";$user = "root";$pass = "abcdefgh";$database = "test";$connect = mysql_connect($host,$user,$pass);$db = mysql_select_db($database,$connect);if($db) { echo success; } else { echo failure;}?>

    the result in browser didn't shown anything.

     

    but after I configure php.ini I give comment on extension=php_mysqli.dll,

     

    then I uncomment on extension=php_mysql.dll

     

    then it can be connect, and show "success".

     

    Q : if I configure php.ini using mysqli, Is there some code on above should be changed?

     

    please help

     

    thanks

  5. This is first installation mysql on my notebook,

     

    Q1 : so, should I uninstall my old installation?

     

    according on : http://dev.mysql.com/downloads/mysql/5.1.html#downloads

     

    Q2 : should I download mysql x86 64 bit version?

     

    Q3 : if I should, which I must download ? (msi installer official or ZIP archieve)

     

    please help me

     

    thanks

     

    _______________________________________________________________________

     

    I don't understand, why every time windows release new version always there is problem, not like when I used windows xp. . . . .

  6. Hello everybody,

     

    finally I can find apache 2.4 that suitable for win 8,

     

    but I got problem again.

     

    After I success install php on apache 2.4 I got problem during installation mysql and phpmyadmin,

     

    I think so that just to the point I will attach screenshot about the error (problem).

     

    1) This is error during installation mysql :

     

    mysql-error_zps285c4090.png

     

    2) This is error during installation phpmyadmin :

     

    phpmyadmin_zpsffe4c038.pngI had read some article on google how to fix it and try it, but not successful.

     

    Q1 : about configuration php : which php that I must choose ? because when I extract php I found 2 php.ini that's :

     

    - php.ini-development

    - php.ini-production

     

    Q2 : how to fix this problem?

     

    this is my specification :

     

    - httpd-2.4.7-win32 -server

    - php-5.3.0-Win32-VC9-x86.zip -php installer

    - mysql-essential-5.1.24-rc-win32.msi -mysql installer

    - phpMyAdmin-3.4.3.1-all-languages - phpmyadmin

     

    please help me to solve this problem

     

    thanks

     

     

    • Like 1
  7. Hi, now my question is not for apache, but for php installer.

     

    I had looking on google PHP installer for Win 64,

     

    on : http://windows.php.net/download/

     

    on this site on php 5.5 VC11 that have version for windows 64 bit, but still experimental

     

    and I search for PHP version 5.3.0 for windows 64 bit

     

    Q : Is there earlier version of PHP installer that for windows 64?

     

    if available, please give me link to download it.

     

    please help

     

    thanks

  8. Hello everyone,

     

    I had search on google to looking for apache 2.x msi for win 64 but I didn't found it,

     

    Q : where I can download it?

     

    I have apache 2.24 msi but for windows 32(x86), yesterday when I install it won't works,

     

    Q : actually can apache 2.x (x86) works well if it's installed on windows 64?

     

    note : my OS is windows 8 Single Language

     

    please help me

     

    thanks

  9. I had delete src/SongList.txt, and change it to : File file = new File("SongList.txt"); but the result :

     

    java.io.FileNotFoundException: SongList.txt (The system cannot find the file specified)
    at java.io.FileInputStream.open(Native Method)
    at java.io.FileInputStream.<init>(Unknown Source)
    at java.io.FileReader.<init>(Unknown Source)
    at Jukebox3.getSongs(Jukebox3.java:22)
    at Jukebox3.go(Jukebox3.java:13)
    at Jukebox3.main(Jukebox3.java:9)
    []
    []
    and about line :
    Song nextSong = new Song(tokens[0], tokens[1], tokens[2], tokens[3]);

    when I delete or add the one of array for instance : I delete tokens[3] or I add token[4] it won't compile.

     

    Q : how to write directory path on File file = new File("SongList.txt"); so, that java .io able to find SongList.txt without using "src/SongList.txt"?

     

    please answer

     

    thanks

  10. Hello everyone,

     

    today I test code from Head First Java book about Jukebox3

     

    (if you have this book please see on page : 537 this is code about Jukebox3, and on page 550 about class Song implements Comparable<Song> chapter 16 about collection and data Structure)

     

    this the code about Jukebox3 :

     import  java.util.*; import  java.io.*;    public class Jukebox3 {         ArrayList<Song> songList = new ArrayList<Song>();	  	  public static void main(String[] args) {	    new Jukebox3().go();		}			  void go() {	     getSongs();		 System.out.println(songList);		 Collections.sort(songList);		 System.out.println(songList);		 }		 	  void getSongs() {	     try {		   File file = new File("src/SongList.txt");		   BufferedReader reader = new BufferedReader(new FileReader(file));		   String line = null;		   while((line = reader.readLine())!=null) {		      addSong(line);		   } // close while		 		 } catch(Exception ex) {		 ex.printStackTrace();		 }		} //close getSongs			   void addSong(String lineToParse) {	     String[] tokens = lineToParse.split("/");		 Song nextSong = new Song(tokens[0], tokens[1], tokens[2], tokens[3]);		 songList.add(nextSong);		} // close addSong	} // closing class					

    and this code about class Song implements Comparable<Song> :

      class Song implements Comparable<Song> {    String title;	String artist;	String rating;	String bpm;		public int compareTo(Song s) {		return title.compareTo(s.getTitle());	}		Song(String t, String a, String r, String  {	  title = t;	  artist = a;	  rating = r;	  bpm = b;	}		public String getTitle() {	  return title;	 }	 	 public String getArtist() {	  return artist;	 }	 	 public String getRating() {	  return rating;	 }	 	 public String getBpm() {	  return bpm;	 }	 	 public String toString() {	  return title;	 }	} // closing class

    both of this code able to compile,

     

    but when I run it's shown message :

     

    java.lang.ArrayIndexOutOfBoundsException: 2
    at Jukebox3.addSong(Jukebox3.java:35)
    at Jukebox3.getSongs(Jukebox3.java:25)
    at Jukebox3.go(Jukebox3.java:13)
    at Jukebox3.main(Jukebox3.java:9)
    []
    []
    Q : Why this code can be compile but when I run this code, it shown like on above?
    whereas, on Head First Java this code can be run well
    please help me
    Thanks
  11. Hello everyone,

     

    long time no see,

     

     

    I think this will more easily if you ever read Head First Java book,

     

    When I tried code on that book on page 450 (chapter 14) about QuizCard builder.

     

    this the code :

    import  java.util.*;import  java.awt.event.*;import  javax.swing.*;import  java.awt.*;import  java.io.*;  public class QuizCardBuilder {     private JTextArea question;     private JTextArea answer;     private ArrayList<QuizCard> cardList;     private JFrame frame;     public static void main(String[] args)  {        QuizCardBuilder builder = new QuizCardBuilder();        builder.go();     }    public void go() {      //build GUI         frame = new JFrame("Quiz Card Builder");      JPanel mainPanel = new JPanel();      Font bigFont = new Font("sanserif", Font.BOLD, 24);      question = new JTextArea(6,20);      question.setLineWrap(true);      question.setWrapStyleWord(true);      question.setFont(bigFont);      JScrollPane qScroller = new JScrollPane(question);      qScroller.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);      qScroller.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);            answer = new JTextArea(6,20);      answer.setLineWrap(true);      answer.setWrapStyleWord(true);      answer.setFont(bigFont);        JScrollPane aScroller = new JScrollPane(answer);      aScroller.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);      aScroller.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);      JButton nextButton = new JButton("Next Card");         cardList = new ArrayList<QuizCard>();      JLabel qLabel = new JLabel("Question :");      JLabel aLabel = new JLabel("Answer : ");      mainPanel.add(qLabel);      mainPanel.add(qScroller);      mainPanel.add(aLabel);      mainPanel.add(aScroller);      mainPanel.add(nextButton);        nextButton.addActionListener(new NextCardListener());      JMenuBar menuBar = new JMenuBar();      JMenu fileMenu = new JMenu("File");      JMenuItem newMenuItem = new JMenuItem("New");      JMenuItem saveMenuItem = new JMenuItem("Save");      newMenuItem.addActionListener(new NewMenuListener());            saveMenuItem.addActionListener(new SaveMenuListener());      fileMenu.add(newMenuItem);      fileMenu.add(saveMenuItem);      menuBar.add(fileMenu);      frame.setJMenuBar(menuBar);      frame.getContentPane().add(BorderLayout.CENTER, mainPanel);      frame.setSize(500,600);      frame.setVisible(true);    }       public class NextCardListener implements ActionListener {      public void actionPerformed(ActionEvent ev) {        QuizCard card = new QuizCard(question.getText(), answer.getText());        cardList.add(card);        clearCard();     }   }    public class SaveMenuListener implements ActionListener {       public void actionPerformed(ActionEvent ev) {        QuizCard card = new QuizCard(question.getText(), answer.getText());        cardList.add(card);                 JFleChooser fileSave = new JFileChooser();        fileSave.showSaveDialog(frame);        saveFile(fileSave.getSelectedFile());     }   }   public class NewMenuListener implements ActionListener {       public void actionPerformed(ActionEvent ev) {        cardList.clear();        clearCard();      }   }  private void clearCard() {     question.setText("");     answer.setText("");     question.requestFocus();  }  private void saveFile(File file) {    try {         BufferedWriter writer = new BufferedWriter(new FileWriter(file));        for(QuizCard card:cardList) {            writer.write(card.getQuestion() + "/");            writer.write(card.getAnswer() + "n");        }     writer.close();     } catch(IOException ex) {       System.out.println("couldn't write the cardList out");       ex.printStackTrace();   }  }}

    the issue is start from : private ArrayList<QuizCard> cardList; .

     

    when I see it using eclipse, it shown : "QuizCard cannot be resolved to a type" and can't compile.

     

    Q : what's mistake on this code?

     

    please someone help me

     

    thanks

     

  12. I had tried to check error on error log but there is no error, today I successful to install php 5.3.0 VC9 thread safe x86. I think there is error on php 5.3.1 installer,because I had tried to install VC6 and 9 but the result are same______________________________________________________________________________ please help me, this is true or not : http://www.dailymail.co.uk/sciencetech/article-476244/Why-blue-eyed-boys-girls-brilliant.html if this is true, maybe I will bring this to my fad article thanks

  13. Hello everyone, long time no see, today I have try to install php 5.31 on apache 2.2 server,but after installation (php 5.3.1) it's cause apache server terminated by windows.I try to start apache server but it won't start and it's shown message : "Could not start Apache 2.2 service on local computer,Error 1067 : The process terminated unexpectedly". unless if I uninstall php 5.3.1, then the apache server can be start. even I try using another apache the result still same. this application that I have tried : - apache_2.2.11-win32-x86-openssl-0.9.8i.msi- apache_2.2.17-win32-x86-openssl-0.9.8i.msi- apache_2.2.22-win32-x86-openssl-0.9.8i.msi and this is my php instaler : - php-5.3.1-Win32-VC6-x86.msi please help me Thanks

  14. Hello everyone, Yesterday my PC tablet was attacked by virus and I plan to format the windows OS then reinstall it, But this is my problem : my pc tablet not have DVD/CD player and I don't have external harddisk , because it's too expensive on my country. I have plan to install windows via my flash disk, but when I looking on google tutorial how to make bootable USB flash disk/drive there is no exact tutorial, I had tried the tutorial but always failed please someone help me Thanks

    • Like 1
  15. So in other word, off topic is prohibited?? (if so, I really sad), I ask off topic (sometimes) just to make myself and moderator just for relax but still serious, imagine, when you learn something, and you too serious without relax can you capture and understand what did you learn? If me, I cannot capture and understand what I learn if too serious, I need some relaxation like talk something or etc, But if I ask off topic my question never offend someone or insult someone thanks for reply . . . . . . . . . . . . . . . . . . .

  16. Hello everyone, today I have been download php 5.3.1 tar.gz from www.oldapps.com, but when I extract it, setup.exe is not available. Q : How to install php from this file? because when I look on google, there is no tutorial that show, how to install through this file. please help me thanks ____________________________________________________________________________________ maybe I will get answer rather long, and before it I want to say : "Merry Christmas and Happy New Year 2013" hope all of you become more success on this year. Bye

  17. if you are trying this from localhost server you must have to do some setting like add port for SMTP and all.. but if u use this on live it will work without any settings..
    I had try this before on live, not at localhost, but this won't work, I use free domain hosting, and the hosting support it. please tell me if there is some setting thanks
  18. Hello everyone, Before I post this thread I want to say "Merry Christmas" for anyone who celebrate. Today I tried to create email to send other email using this code :

    <?php$to = "myemail@gmail.com";$subject = "Test mail";$message = "Hello! This is a simple email message.";$from = "someonelse@example.com";$headers = "From:" . $from;mail($to,$subject,$message,$headers);echo "Mail Sent.";?>

    But when I open my email, it won't sent anything, Q : Actually what requirement to create email, so that at least it can be send message to other email? please someone answer me Thanks

  19. Thanks for answer before, But this is not my expectation answer. I didn't understand on :

    foreach($_SESSION['cart'] as $product_id => $quantity) { 		//get the name, description and price from the database - this will depend on your database implementation.		//use sprintf to make sure that $product_id is inserted into the query as a number - to prevent SQL injection		$sql = sprintf("SELECT p_id, p_title, p_price, p_image FROM product WHERE p_id = %d;",				$product_id); 		$result = mysql_query($sql); 		//Only display the row if there is a product (though there should always be as we have already checked)		if(mysql_num_rows($result) > 0) { 		 list($p_id, $p_title, $p_price, $p_image) = mysql_fetch_row($result); 		 $line_cost = $p_price * $quantity;  //work out the line cost		 $total = $total + $line_cost;   //add to the total cost								  }		}		} 

    (please see on CODE 2). My point : if I using foreach($_SESSION['cart'] as $product_id => $quantity) it's show all product. Whereas to display product 2 per page I need to using for function. How to replace it using for function ? I stuck if I tried to replace foreach to for function like this :

    for($x=0;$x<$total;$x++){$_SESSION['cart'][$product][$x]}

    at least how to change $p_id ,$p_title,$p_image,$p_price on code :

    echo"		<div class=\"b_content\">				 <form method=\"post\" action=\"?p=basket&action=change&id=$p_id\">				  <div class=\"b_img\"><img src=\"product/$p_image\" width=\"105px\" height=\"152px\" border=\"1\"/></div>		   <div class=\"b_detail\">				   <div class=\"b_columnL\">Book Name : </div> <div class=\"b_columnR\"><b>$p_title</b></div>				   <div class=\"b_columnL\">Price Per Book : </div> <div class=\"b_columnR\">$p_price</div>				   <div class=\"b_columnL\">Total Item : </div> <div class=\"b_columnR\"><input type=\"text\" name=\"qty\" style=\"width:20px;text-align:center;border:1px solid #000066;\" maxlength=\"3\" value=\"$quantity\" /></div>				   <div class=\"b_columnL\">Total Price : </div> <div class=\"b_columnR\">USD $line_cost</div>				   <div class=\"b_columnL\"><a href=\"basket.php?action=remove&id=$p_id\">Delete</a></div> <div class=\"b_columnR\"><input type=\"submit\" value=\"RECALCULATE\" /></div>								</div>		  </form>		  </div>";

    please help thanks

  20. I think today I found my problem : to display using for function I need to know how to display session value, I had tried like this code :

    $total_order = count($_SESSION['cart']);		echo"<div class=\"b_title\">   <div align=\"center\"><b>Your total order on basket : <font color=\"#000066\">$total_order</font></b></div>   </div>";		$sql ="SELECT * FROM product WHERE p_id = %d"; 		$result = mysql_query($sql);	   $t_order = mysql_fetch_row($result);	  	   for($x=0;$x<$total_order;$x++){		 $a[$x][0] = $t_order[1];		echo $a[$x][0]  ;	  }  	  else if(!$_SESSION['m_user']){echo "<div class=\"b_title\" style=\"color:#000099\"><b>You have no item in your basket cart</b></div>";}

    Note : I tried to change code 2. But still not successful. please someone give me hint how to show the session value. Thanks

  21. Hello all I had tried to make so that session display value according on product that choose by user. But it's still fail, this is my code : CODE 1 :

    if($product_id && !productExists($product_id)) {  die("Error. Product Doesn't Exist");}switch($action) { //decide what to do   case "add":   $_SESSION['cart'][$product_id]++; //add one to the quantity of the product with id $product_id  break;   case "remove":   //$_SESSION['cart'][$product_id]--; //remove one from the quantity of the product with id $product_id   /*if($_SESSION['cart'][$product_id] == 0)*/ unset($_SESSION['cart'][$product_id]); //if the quantity is zero, remove it completely (using the 'unset' function) - otherwise is will show zero, then -1, -2 etc when the user keeps removing items.  break;   case "empty":   unset($_SESSION['cart']); //unset the whole cart, i.e. empty the cart.  break;   case "change":	$_SESSION['cart'][$product_id]=+$qty;	if(preg_match("/[.]/",$qty)){$_SESSION['cart'][$product_id]=+1;}	if($_SESSION['cart'][$product_id] == 0){unset($_SESSION['cart'][$product_id]);}  break; }

    CODE 2 :

    foreach($_SESSION['cart'] as $product_id => $quantity) {  	//get the name, description and price from the database - this will depend on your database implementation.	//use sprintf to make sure that $product_id is inserted into the query as a number - to prevent SQL injection	$sql = sprintf("SELECT p_id, p_title, p_price, p_image FROM product WHERE p_id = %d;",		$product_id);		$result = mysql_query($sql);		//Only display the row if there is a product (though there should always be as we have already checked)	if(mysql_num_rows($result) > 0) {  	 list($p_id, $p_title, $p_price, $p_image) = mysql_fetch_row($result);  	 $line_cost = $p_price * $quantity;  //work out the line cost	 $total = $total + $line_cost;   //add to the total cost 	   echo"	<div class=\"b_content\">		 <form method=\"post\" action=\"?p=basket&action=change&id=$product_id\">		  <div class=\"b_img\"><img src=\"product/$p_image\" width=\"105px\" height=\"152px\" border=\"1\"/></div>	   <div class=\"b_detail\">		   <div class=\"b_columnL\">Book Name : </div> <div class=\"b_columnR\"><b>$p_title</b></div>		   <div class=\"b_columnL\">Price Per Book : </div> <div class=\"b_columnR\">$p_price</div>		   <div class=\"b_columnL\">Total Item : </div> <div class=\"b_columnR\"><input type=\"text\" name=\"qty\" style=\"width:20px;text-align:center;border:1px solid #000066;\" maxlength=\"3\" value=\"$quantity\" /></div>		   <div class=\"b_columnL\">Total Price : </div> <div class=\"b_columnR\">USD $line_cost</div>		   <div class=\"b_columnL\"><a href=\"basket.php?action=remove&id=$product_id\">Delete</a></div> <div class=\"b_columnR\"><input type=\"submit\" value=\"RECALCULATE\" /></div>				</div>	  </form>	  </div>";	}	}

    Information :- Code 1 purposed to tell computer to add or delete or change product.- Code 2 purposed to display product according on data that displayed by code 1. My point : How to display value of $_SESSION['cart'][$product_id] without using foreach php ? Note : I had tried using code like this but it's not successful:

    <?echo $_SESION['cart'][$product_id][0];?>

    please someone help me Thanks

  22. Hello everyone, today I read post on : http://w3schools.inv...uncement=9&f=50. On there written if hacking can be punishable by law. Q : From where police can know who do hacking , till they can caught the hacker then cast them in to the jail? ( I've heard news hacker caught by police after do hack in to bank.) please someone answer me. Thanks______________________________________________________________________________________ Note : I ask this question is not for weird act.

    • Like 1
×
×
  • Create New...