Update database through php

Hi, my hosting provider doesnt allow me to access my database via mysql, could someone please help me out . i need a php file which will connect to the database and alter some tables with the following details

eg.

ALTER TABLE category ADD INDEX ( parent_id ) ;
ALTER TABLE category ADD INDEX ( top ) ;
ALTER TABLE category ADD INDEX ( sort_order ) ;

any help would be great

<?php $con = mysql_connect("localhost","username","password"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("dbname", $con); mysql_query("ALTER TABLE 'category' ADD INDEX ('parent_id' )"); mysql_query("ALTER TABLE 'category' ADD INDEX ( 'top' ) ;"); mysql_query("ALTER TABLE 'category' ADD INDEX ('sort_order' )"); mysql_close($con); ?>

Sajan you forgot to select database.

R you sure RaythXC ? 8)

Looks again

Oh…

Are you sure that your details connecting to the database is correct? If you don’t have details, it would be (localhost,root) and no password

Sponsor our Newsletter | Privacy Policy | Terms of Service