Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

php + mssql question thanks

Status
Not open for further replies.

melnet

Programmer
Joined
Jul 8, 2003
Messages
77
Location
HK
hi

$title="select * from kind";
$description="This is sample4";

$result = mssql_query("INSERT INTO mynote(title, description) VALUES($title, $description)"); //line 8
echo "action=add&success=1";

error:
Warning: mssql_query() [function.mssql-query]: message: Incorrect syntax near the keyword 'select'. (severity 15) in F:\PHP\notpad\add.php on line 8

Warning: mssql_query() [function.mssql-query]: message: Incorrect syntax near the keyword 'is'. (severity 15) in F:\PHP\notpad\add.php on line 8

Warning: mssql_query() [function.mssql-query]: Query failed in F:\PHP\notpad\add.php on line 8

what error of them!?
thanks for help
 
first of all it you're $title wrong

Code:
$query="SELECT * from artisttable order by arname";
$rs=mysql_query($query,$conn);

$list = mysql_num_rows($rs); 
while($i < $list)	
{
$row = mysql_fetch_array($rs); 
$arid=$row[&quot;arid&quot;];
$arname=$row[&quot;arname&quot;];
$arspecsnl=substr($row[&quot;arspecsnl&quot;],0,30).&quot;...&quot;;


if ($j==0){
	print&quot;<tr valign=top class=inspr2>&quot;; 
	$j++;
	} else	{
   	print&quot;<tr valign=top class=inspr>&quot;; 
	$j=0;
	}

   print&quot;<td>$arname<br></td>&quot;; 
   print&quot;<td>$arspecsnl<br></td>&quot;; 
   print&quot;<td><a href=arform.php3?arid=$arid>EDIT</a><br></td>&quot;; 
   print&quot;<td><a href=aragenda.php3?arid=$arid>AGENDA</a><br></td>&quot;; 
   print&quot;</tr>&quot;; 

$i++;
}

here is an example whereyou can filter out how to do it
and second why not use

$result = mssql_query(&quot;INSERT INTO mynote(title, description) VALUES SELECT title,'this is sample 4'from kind&quot;)

and third , WHY PUT A MMSSQL QUERY ON AN MYSQL BOARD ???????

now I'm not surprised that I recognized a hundred errors :(
 
oh sorry this was on the php board and not the mysql board
 
oh thanks for help...
next time i will post on mysql board.
sorry....
 
he I was the one who need to say sorry. but sometimes it's confusing and look so much alike the mssql or mysql questions ;)


hope my second suggestion would solve you're problem
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top