Saturday, 15 January 2011

mysql - Query running in PHPmyadmin but not through PHP -


I am trying to run a query from PHP which is not running but I can run the query from phpMyAdmin < / P>

Here is the code

  & lt ;? Php ob_start (); // Delete the item questions for the administrator and delete the product "../ stores/connect_to_miskyl.fp"; $ Conn = mysql_connect ("$ db_host", "$ db_username", "$ db_pass", "$ db_name") or die ("can not connect to mysql"); If (isset ($ _gET ['deleteid'])) 'echo' you really want to delete items with id. ' $ _GET ['deleteid']. '? & Lt; A href = "inventory_list.php? Hordial = '. $ _GET [' deleted ']." "Gt; yes  |  

Your help is sought so that I am new to PHP, I am able to connect to the database in another instance whose code is followed

  & lt ;; Php // user check ob_start (); Session_start (); If (! Isset ($ _ session ["manager"])) {header ("location: admin_login.php"); Go out(); } // Be sure to ensure that this manager session value is in the database $ managerID = preg_replace ('# [^ 0-9] #i', '', $ _ session ["id"]); $ Manager = preg_replace ('# [^ a-zA-Z0-9] #I', '', $ _ session ["manager"]); $ Password = preg_replace ('# [^ A-zA-Z0-9] #I', '', $ _ session ["password"]); // runMYSQL query to ensure that this manager is connected to / mysql database includes "../ storecripts / connect_to_mysql.php"; $ Sql ​​= mysql_query ("SELECT * by admin WHERE id = '$ managerID' and user name = '$ manager' and password = '$ password'LIMIT 1"); // Make sure the person is present in the database database present; Calculation = mysql_num_rows ($ sql); If ($ Existing count == 0) {Resonant "Your data does not match our records"; Go out(); }? & Gt;  

The code in connect_to_my_sql.php is as follows

   & Gt; ??? Mysql ?? Someserver.net $ db_host = "localhost"; // Place the username here for the MySQL database $ db_username = "storeuser"; // Place the password for the MySQL database here $ db_pass = "rajjar"; // Name MySQL database here for $ db_name = "mystore"; // real connection run here $ conn = mysql_connect ("$ db_host", "$ db_username", "$ db_pass", "$ db_name") or die ("can not connect to mysql"); // mysql_select_db ("$ db_name") or die ("no database"); ? & Gt;  


No comments:

Post a Comment