query()

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
dotoho
Forum Newbie
Posts: 14
Joined: Tue Aug 08, 2006 5:12 am

query()

Post by dotoho »

Pimptastic | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


dear all ,
   I have had error message : Fatal error: Call to undefined function query() in D:\htdocs\quiz\data.php on line 39 
    when i used function query()  .How to do this,brosss???
  and this is my code :

Code: Select all

<html>
<body>
<p> 1.Hay chon 1 trong 2 : </p>
<?php
 $question= $_POST['question'];
 $answer1 = $_POST['answer1'];
 $answer2 = $_POST['answer2'];
 
 if(!$question||!$answer1||!$answer2){
  echo 'BAn dien ko day du.hay quay lai de hoan thanh';
  exit;
 }
 if(!get_magic_quotes_gpc())
 {
 $question  = addslashes($question);
 $answer1  = addslashes($answer1);
 $answer2  = addslashes($answer2);
 }
 
@ $db = mysql_connect("localhost", "root","ha1985") or die("No way");
 
mysql_select_db("myapp",$db) or die("Không ch&#7885;n c&#417; s&#7903; d&#7919; li&#7879;u &#273;&#432;&#7907;c");
 
 
       
	[size=18]	$query = "insert into question " . "(question,answer1,answer2) values"
			. "('$question', '$answer1', '$answer2')";
			
	query($query);
		$msg .= "<h3>complete to sign";
		$question = $answer1 = $answer2 = "";[/b]
            
        
 

?>
</body>
</html>


Pimptastic | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Post by Benjamin »

Code: Select all

query($query);
Should be

Code: Select all

mysql_query($query);
dotoho
Forum Newbie
Posts: 14
Joined: Tue Aug 08, 2006 5:12 am

Post by dotoho »

astions wrote:

Code: Select all

query($query);
Should be

Code: Select all

mysql_query($query);
runnnn
okei okei,thanxxx much ,
but u can explain for me that why i can't use only "query " ???
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

dotoho wrote:but u can explain for me that why i can't use only "query " ???
...becuase it isn't a PHP function
Post Reply