Re: input SQL data through text box and get nothing?



marslee@xxxxxxxxxxx wrote:
I want to add SQL command through a textbox in the form using post
method,but when i execute the following file, nothing is added to the
database.
I can add
     $sqlol = "update  acc_account
	    set user_name='k'
	  where accountid=1";
to the database if it was added to the file but when i use $result =
mysql_query($sql); which execute the query, it get nothing. However,
the $sql statement do print out on the screen using  print.

Any idea?

<?php
$conn=mysql_connect('localhost', 'shytr8');

if(!$conn)
{print "Error- Could not connect to MYSQL";
	exit;}

$er=mysql_select_db("test");

if(!$er){
	print "Error- Could not create er";
	$query  = "CREATE DATABASE test";
	mysql_query($query);}



$sql=$_POST[SQLcommand];
$result = mysql_query($sql);	
?>



What's the result from mysql_query?

  if (!$result)
    echo mysql_error();


-- ================== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstucklex@xxxxxxxxxxxxx ================== .



Relevant Pages

  • Re: Newbie question about formula based values
    ... if the query hangs or if Access crashes or is someone restarts ... If you want to execute the code from your web site, you can do that as well. ... If your web site can execute SQL code against an Access database, ... In Windows scheduler, create a new scheduled task based on Microsoft ...
    (comp.databases.ms-access)
  • TIP #308: Twylites concerns
    ... If, as you say, the simple change of adding a place for [$db execute] ... likely the result of a query against a system catalog. ... > especially for a pure-Tcl implementation for a specific database. ... 'execute' functionality that you discussed above address this concern? ...
    (comp.lang.tcl)
  • Re: .Execute vs. .RunSQL - Speed vs. Size
    ... >to know which is faster - Dim a database and then use the db.execute method ... Execute a sequence of action queries. ... Note that Execute requires you to resolve any query ... can gain orders of magnitude better improvement by making ...
    (microsoft.public.access.formscoding)
  • Re: Cross-database execution permissions with certificates and sch
    ... activated user cannot access objects in other schemas in this database. ... injection is defended against, however, the threat exists anywhere EXECUTE ... CREATE USER dispatcher ... the certificate is a trusted authenticator because you granted AUTHENTICATE ...
    (microsoft.public.sqlserver.security)
  • Re: disable index while doing insert into
    ... source and target table have multiple indexes, ... to execute this query but when i've deleted the indexes on target ... This is a price you have to pay on any database not just Sybase. ...
    (comp.databases.sybase)