Hi All,
I am able to connect to a database on SQL server1 ,but none of my SQL queries seem to be working. The same queries work fine on a different SQL server, where i have used the SQL queries directly on the database and not though PHP script,as there is a problem connecting to this server.
Can i know why my SQL queries are not working on SQL server1, while the same queries work on a different server?Unfortun ately i can access the Server1 database only through PHP scripts, so i cant know what is the error on the server. Please let me know. Below is the script.
[php]<HTML><head><ti tle>Sql test</title></head>
<body>
<?php
$host = "xxxxxx.com ";
$usr = "xxxx";
$pwd = "xxxxxxxxxx xx";
$cid = @mysql_connect( $host,$usr,$pwd );
echo"$cid<br>";
$db = "chin";
$SQL = 'CREATE TABLE Photos (id int(6) unsigned NOT NULL auto_increment, filename varchar(100) NOT NULL default \",gallery varchar(100) NOT NULL default \",PRIMARY KEY (id)) TYPE=MyISAM';
$SQL2 = 'INSERT INTO Photos VALUES (1,\'PinkRose\' ,\'images\')';
$SQL3 = 'SELECT * FROM Photos ';
$result = @mysql_select_d b($db,$cid);
$result2=mysql_ query($SQL);
mysql_query($SQ L2);
$result2 = @mysql_db_query ($db,$SQL3,$cid );
$res3 = mysql_affected_ rows();
mysql_close();
echo"$result :(<br>";
echo "<p>$result 2 </p>";
echo"<br> res3= $res3<br>";
?>
</body>
</html>[/php]
Thanks ,
CNR
I am able to connect to a database on SQL server1 ,but none of my SQL queries seem to be working. The same queries work fine on a different SQL server, where i have used the SQL queries directly on the database and not though PHP script,as there is a problem connecting to this server.
Can i know why my SQL queries are not working on SQL server1, while the same queries work on a different server?Unfortun ately i can access the Server1 database only through PHP scripts, so i cant know what is the error on the server. Please let me know. Below is the script.
[php]<HTML><head><ti tle>Sql test</title></head>
<body>
<?php
$host = "xxxxxx.com ";
$usr = "xxxx";
$pwd = "xxxxxxxxxx xx";
$cid = @mysql_connect( $host,$usr,$pwd );
echo"$cid<br>";
$db = "chin";
$SQL = 'CREATE TABLE Photos (id int(6) unsigned NOT NULL auto_increment, filename varchar(100) NOT NULL default \",gallery varchar(100) NOT NULL default \",PRIMARY KEY (id)) TYPE=MyISAM';
$SQL2 = 'INSERT INTO Photos VALUES (1,\'PinkRose\' ,\'images\')';
$SQL3 = 'SELECT * FROM Photos ';
$result = @mysql_select_d b($db,$cid);
$result2=mysql_ query($SQL);
mysql_query($SQ L2);
$result2 = @mysql_db_query ($db,$SQL3,$cid );
$res3 = mysql_affected_ rows();
mysql_close();
echo"$result :(<br>";
echo "<p>$result 2 </p>";
echo"<br> res3= $res3<br>";
?>
</body>
</html>[/php]
Thanks ,
CNR
Comment